build.gradle 设置如何与 "gcloud firebase test android run" 参数相关?

How are build.gradle settings related to "gcloud firebase test android run" parameters?

gcloud firebase test android run 提供的参数也可以在模块的 build.gradle 文件中配置。

它们之间有什么关系?

  1. Firebase 测试实验室参数是否优先于 build.gradle 参数?
  2. 当您 运行 Firebase 测试实验室时,它是否完全忽略 build.gradle 参数?

例如:

  1. Firebase 测试实验室参数如何--test-runner-class related to the build.gradle parameter testInstrumentationRunner
  2. Firebase 测试实验室参数如何--environment-variables clearPackageData=true related to the build.gradle parameter testInstrumentationRunnerArguments clearPackageData

gcloud 不使用或理解任何 Gradle 选项或文件。它从您作为 gcloud firebase test android run 的一部分传递的选项和文件中获取所有信息。 Gradle 使用其选项,例如build.gradle 以特定方式编译应用和测试 APK。 IE。您需要了解哪些 Gradle 选项与编译阶段和测试执行阶段相关。

testInstrumentationRunner

testInstrumentationRunner参数写入测试APK中的AndroidManifest.xml。 Android 上的测试执行器然后使用此运行程序执行测试。

话虽如此,gcloud 允许通过 --test-runner-class 参数覆盖 testInstrumentationRunner。来自帮助:

 --test-runner-class=TEST_RUNNER_CLASS
    The fully-qualified Java class name of the instrumentation test runner
    (default: the last name extracted from the APK manifest).

testInstrumentationRunnerArguments

这些用于通过Gradle执行测试。它们未写入 APK。 gcloud 不会知道您要使用这些选项。您需要通过 --environment-variables 参数传递它们,如您的示例所示。