0

gcloud firebase test android run offers parameters which are also configurable in a module's build.gradle file.

How are they related to each other?

  1. Do Firebase Test Lab parameters take precedence over build.gradle parameters?
  2. When you run Firebase Test Lab, does it completely ignore build.gradle parameters?

For example:

  1. How is the Firebase Test Lab parameter --test-runner-class related to the build.gradle parameter testInstrumentationRunner
  2. How is the Firebase Test Lab parameter --environment-variables clearPackageData=true related to the build.gradle parameter testInstrumentationRunnerArguments clearPackageData
Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113

1 Answers1

2

gcloud does not use or understand any Gradle options or files. It takes all its information from the options and files that you pass as part of gcloud firebase test android run. Gradle uses its options from e.g. build.gradle to compile the app and test APKs in a specific way. I.e. you need to understand what Gradle options are related to the compile phase vs. the test execution phase.

testInstrumentationRunner

The testInstrumentationRunner parameter is written into the AndroidManifest.xml in the test APK. The test executor on an Android then uses this runner to execute the test.

Having said that, gcloud allows to override the testInstrumentationRunner via the --test-runner-class argument. From the help:

 --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

These are used to execute the test via Gradle. They are not written into the APKs. gcloud will not know that you want to use these options. You need to pass them via the --environment-variables argument, as in your example.

Maik
  • 3,419
  • 1
  • 23
  • 34
  • Brilliant, maik, thank you. What you've saying could also be a good answer to https://stackoverflow.com/questions/57538106/how-to-pass-gradle-project-settings-on-the-command-line-to-gcloud-firebase-test. Feel free to submit an answer to that one and I'll accept it. – Michael Osofsky Aug 19 '19 at 17:26