Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud CLI: How to run instrumentation tests with clearPackageData argument?

I'm running my tests using gcloud firebase test android run command with --use-orchestrator flag to enable Android Test Orchestrator. There is an Orchestrator argument clearPackageData to clear app's state between tests, which I'm able to use when run tests from Android Studio on my own device:

android {
  defaultConfig {
   ...
   testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

   // The following argument makes the Android Test Orchestrator run its
   // "pm clear" command after each test invocation. This command ensures
   // that the app's state is completely 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'
}

However, when running tests in Firebase Test Lab with the command and the flag I mentioned above, this argument is set to false. Is there a way to set this argument to true?

like image 443
pavelicii Avatar asked Jun 19 '18 06:06

pavelicii


1 Answers

Use this on the gcloud command line:

--environment-variables clearPackageData=true
like image 165
Doug Stevenson Avatar answered Oct 11 '22 02:10

Doug Stevenson