我正在使用 gcloud firebase test android run 运行我的测试带有 --use-orchestrator
标志的命令以启用 Android Test Orchestrator。 There is一个 Orchestrator 参数 clearPackageData
以清除应用程序在测试之间的状态,我可以在我自己的设备上从 Android Studio 运行测试时使用它:
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'
}
但是,当使用上面提到的命令和标志在 Firebase 测试实验室中运行测试时,此参数设置为 false
。有没有办法将此参数设置为 true
?
最佳答案
在 gcloud 命令行上使用它:
--environment-variables clearPackageData=true
关于android - gcloud CLI : How to run instrumentation tests with clearPackageData argument?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50921521/