Add More UI Tests
Create the GameFragmentTests class just like you did with PickPlayersFragmentTests, adding it to the androidTest folder of your project. Then, once again add the activityScenarioRule and annotate the class with @RunWith(AndroidJUnit4::class). In addition, add a second annotation called @ExperimentalCoroutinesApi. This annotation allows us to use, without a warning, the runBlockingTest TestCoroutineScope. This is a handy scope to use (for tests only) because it allows us to call suspend functions while skipping any delays in our code. We’re using it here for our @Before function startNewGameBeforeEachTest, as running this function normally causes timing issues with starting a game and checking values.
I would have liked to use ...
Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.