How is it possible to restart the application or start killing your activity before starting your tests? Because if this is not done, the data that I enter in the DatePicker remain unchanged for the following tests.

At the moment I am trying to implement something like this :

@Rule @JvmField val mActivityTestRule = ActivityTestRule(SignActivity::class.java, false, false) 

Then in the annotation @Before I use:

 @Before @Throws(Exception::class) fun setUp() { DatabaseTestTools.clearDatabase() mActivityTestRule.launchActivity(null) } 

Unfortunately, the data still remains. I also tried to access the current activity and then try to destroy it:

 CurrentActivityUtil().activityInstance?.finish() 

    0