Since fun showsSecondQuestionAfterNextPress() has already performed next click and the question_text_view has changed to question_oceans, why in fun handlesActivityRecreation() another next click to make the question_text_view still question_oceans? Shouldn’t it be “question_mideast” ?
1 Like
Earlier in class MainActivityTest we include the code:
@Before
fun setUp() {
scenario = launch(MainActivity::class.java)
}
@After
fun tearDown() {
scenario.close()
}
This code, specifically ‘fun tearDown()’, closes down our ‘scenario’ after being called. The ‘@After’ annotation which appears before ‘fun tearDown()’ means the function ‘tearDown()’ will be called after running every JUnit test that appears in the rest of the class. The ‘scenario’ is an instance of MainActivity so it closes down the app after running a test. The code ‘fun setUp()’ launches a new MainActivity instance and assigns it to ‘scenario’ when it is called. The @Before annotation which appears before 'fun setUp() means the function ‘setUp()’ will be called before running every JUnit test that appears in the rest of the class. This code restarts our app with each new test.
1 Like