Skip to content

Instantly share code, notes, and snippets.

@RicardoBelchior
Last active March 13, 2019 18:20
Show Gist options
  • Save RicardoBelchior/b178004fd292702562a3db9f6534a203 to your computer and use it in GitHub Desktop.
Save RicardoBelchior/b178004fd292702562a3db9f6534a203 to your computer and use it in GitHub Desktop.
Fragment test example, using Robolectric
private lateinit var activity: MyActivity
@Before
fun setUp() {
// Prepare fake data for MyActivity and MyFragment
// ...
// Open the activity that contains the Fragment under test
activity = Robolectric.setupActivity(MyActivity::class.java)
// If necessary, click button X to open the fragment
// ...
}
@Test
fun `when loading, progressbar is displayed`() {
whenSearchReturns(Single.never())
performQuery("brexit")
progressBar().shouldBeVisible()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment