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

标签 android firebase android-testing gcloud firebase-test-lab

我正在使用 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/

相关文章:

android-jetpack-compose - Firebase 应用程序中 Compose 的仪器测试

android - 如何使用 Android NDK 的共享库(C 库添加到 C++)

android - Netbeans、android-maven-plugin 和使用 apklib/aar 依赖项

android - 在 Firebase/Android 聊天应用程序中发送和接收大图像文件的最佳方法是什么

java - 从Firebase数据库获取最后一个节点到textview android

Android Espresso ActivityTest 给出 'package android.support.test.rule does not exist'

android - 您的项目包含错误,请在运行前修复它

vmware 上的 Android X86,Google Play 需要 wifi

ios - 在 firebase 中存储值时无法使用 userID 作为键

android-gradle-plugin - 仅测试模块中的等效 androidTestUtil 是什么