Last active
March 13, 2019 18:20
-
-
Save RicardoBelchior/b178004fd292702562a3db9f6534a203 to your computer and use it in GitHub Desktop.
Fragment test example, using Robolectric
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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