Android Test Orchestrator

Andres Sandoval
1 min readAug 8, 2018

Using Orchestrator it’s great! Improves Android automation test runs. Orchestrator ensures that the app’s state is completely cleared between tests, helps solve flaky tests. Background.

Configuration: it’s pretty easy, just add below code to your build.gradle

android {..
defaultConfig {..
// Espresso tests
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}}}
dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
}

Clean project, and now using Android Studio run your Espresso tests using Orchestrator.

Firebase TestLab: Run Orchestrator on Firebase TestLab with below command. Add flag use-orchestrator.

'gcloud firebase test android run --type instrumentation --app /Users/asandoval/dev/android/APP/build/outputs/apk/your-app-googleFlavor-your-app-Free-x86-debug-*.apk --test /Users/asandoval/dev/android/APP/build/outputs/apk/androidTest/googleFlavor-your-app-FreeX86/debug/your-app-googleFlavor-your-app-Free-x86-debug-androidTest.apk --device-ids Pixel2 --os-version-ids 27 --locales en_US --orientations portrait --use-orchestrator --timeout 19m --test-targets="class yourapp.suite.AcceptanceTestSuite"'

--

--