Reputation: 47
When I run multiple espresso tests, I find that the app does not restart but starts from the same location that it is left off. How to make it start from the beginning everytime
Upvotes: 1
Views: 1143
Reputation: 2825
Consider Android Test Orchestrator. It will clear all data and restart Instrumentation between each test.
Add to app Gradle:
android {
defaultConfig {
...
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}
}
dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
}
And then run it as follows:
./gradlew connectedCheck
Upvotes: 1