Tests pass when run individually but not when the whole test class run

后端 未结 5 1368
感动是毒
感动是毒 2021-01-02 04:38

I have solved a topCoder problem for which all the tests pass when I run them on their own. Nonetheless when I run the whole test class some of them fail. Could you, please,

5条回答
  •  青春惊慌失措
    2021-01-02 05:08

    Since I am opening the same activity under test in many test cases executed one after another and same IntentsTestRule class activity

    I could resolve the issue in my case by calling finishActivity on activityTestRule class and intentTestRule class

    eg:

    @After
    fun method() {
    
    mainActivityTestRule.finishActivity()
    
    mIntentsRule.finishActivity()
    
    }
    

提交回复
热议问题