gcloud firebase test android run <ARGSPEC>

Invoke a test in Firebase Test Lab for Android and view test results

Arguments

NameDescription
ARGSPECAn ARG_FILE:ARG_GROUP_NAME pair, where ARG_FILE is the path to a file containing groups of test arguments in yaml format, and ARG_GROUP_NAME is the particular yaml object holding a group of arg:value pairs to use. Run *$ gcloud topic arg-files* for more information and examples

Options

NameDescription
--account <ACCOUNT>Google Cloud Platform user account to use for invocation. Overrides the default *core/account* property value for this command invocation
--additional-apks <APK>A list of up to 100 additional APKs to install, in addition to those being directly tested. The path may be in the local filesystem or in Google Cloud Storage using gs:// notation
--app <APP>The path to the application binary file. The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. Android App Bundles are specified as .aab, all other files are assumed to be APKs
--app-package <APP_PACKAGE>(REMOVED) The Java package of the application under test. By default, the application package name is parsed from the APK manifest. + Flag --app-package has been removed
--asyncInvoke a test asynchronously without waiting for test results
--auto-google-loginAutomatically log into the test device using a preconfigured Google account before beginning the test. Enabled by default, use --no-auto-google-login to disable
--billing-project <BILLING_PROJECT>The Google Cloud Platform project that will be charged quota for operations performed in gcloud. If you need to operate on one project, but need quota against a different project, you can use this flag to specify the billing project. If both `billing/quota_project` and `--billing-project` are specified, `--billing-project` takes precedence. Run `$ gcloud config set --help` to see more information about `billing/quota_project`
--configuration <CONFIGURATION>The configuration to use for this command invocation. For more information on how to use configurations, run: `gcloud topic configurations`. You can also use the CLOUDSDK_ACTIVE_CONFIG_NAME environment variable to set the equivalent of this flag for a terminal session
--device <DIMENSION=VALUE>A list of ``DIMENSION=VALUE'' pairs which specify a target device to test against. This flag may be repeated to specify multiple devices. The four device dimensions are: *model*, *version*, *locale*, and *orientation*. If any dimensions are omitted, they will use a default value. The default value, and all possible values, for each dimension can be found with the ``list'' command for that dimension, such as `$ {parent_command} models list`. *--device* is now the preferred way to specify test devices and may not be used in conjunction with *--devices-ids*, *--os-version-ids*, *--locales*, or *--orientations*. Omitting all of the preceding dimension-related flags will run tests against a single device using defaults for all four device dimensions. + Examples: + ``` --device model=Nexus6 --device version=23,orientation=portrait --device model=shamu,version=22,locale=zh_CN,orientation=default ```
--device-ids <MODEL_ID>The list of MODEL_IDs to test against (default: one device model determined by the Firebase Test Lab device catalog; see TAGS listed by the `$ {parent_command} devices list` command)
--directories-to-pull <DIR_TO_PULL>A list of paths that will be copied from the device's storage to the designated results bucket after the test is complete. These must be absolute paths under `/sdcard`, `/storage`, or `/data/local/tmp` (for example, `--directories-to-pull /sdcard/tempDir1,/data/local/tmp/tempDir2`). Path names are restricted to the characters ```a-zA-Z0-9_-./+```. The paths `/sdcard` and `/data` will be made available and treated as implicit path substitutions. E.g. if `/sdcard` on a particular device does not map to external storage, the system will replace it with the external storage path prefix for that device. Note that access to some directories on API levels 29 and later may also be limited by scoped storage rules
--environment-variables <KEY=VALUE>A comma-separated, key=value map of environment variables and their desired values. The environment variables are mirrored as extra options to the `am instrument -e KEY1 VALUE1 ...` command and passed to your test runner (typically AndroidJUnitRunner). Examples: + Enable code coverage and provide a directory to store the coverage results when using Android Test Orchestrator (`--use-orchestrator`): + ``` --environment-variables clearPackageData=true,coverage=true,coverageFilePath=/sdcard/ ``` + Enable code coverage and provide a file path to store the coverage results when *not* using Android Test Orchestrator (`--no-use-orchestrator`): + ``` --environment-variables coverage=true,coverageFile=/sdcard/coverage.ec ``` + Note: If you need to embed a comma into a `VALUE` string, please refer to `gcloud topic escaping` for ways to change the default list delimiter
--filter <EXPRESSION>Apply a Boolean filter _EXPRESSION_ to each resource item to be listed. If the expression evaluates `True`, then that item is listed. For more details and examples of filter expressions, run $ gcloud topic filters. This flag interacts with other flags that are applied in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*
--flags-file <YAML_FILE>A YAML or JSON file that specifies a *--flag*:*value* dictionary. Useful for specifying complex flag values with special characters that work with any command interpreter. Additionally, each *--flags-file* arg is replaced by its constituent flags. See $ gcloud topic flags-file for more information
--flatten <KEY>Flatten _name_[] output resource slices in _KEY_ into separate records for each item in each slice. Multiple keys and slices may be specified. This also flattens keys for *--format* and *--filter*. For example, *--flatten=abc.def* flattens *abc.def[].ghi* references to *abc.def.ghi*. A resource record containing *abc.def[]* with N elements will expand to N records in the flattened output. This flag interacts with other flags that are applied in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*
--format <FORMAT>Set the format for printing command output resources. The default is a command-specific human-friendly output format. The supported formats are: `config`, `csv`, `default`, `diff`, `disable`, `flattened`, `get`, `json`, `list`, `multi`, `none`, `object`, `table`, `text`, `value`, `yaml`. For more details run $ gcloud topic formats
--helpDisplay detailed help
--impersonate-service-account <SERVICE_ACCOUNT_EMAIL>For this gcloud invocation, all API requests will be made as the given service account instead of the currently selected account. This is done without needing to create, download, and activate a key for the account. In order to perform operations as the service account, your currently selected account must have an IAM role that includes the iam.serviceAccounts.getAccessToken permission for the service account. The roles/iam.serviceAccountTokenCreator role has this permission or you may create a custom role. Overrides the default *auth/impersonate_service_account* property value for this command invocation
--limit <LIMIT>Maximum number of resources to list. The default is *unlimited*. This flag interacts with other flags that are applied in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*
--locales <LOCALE>The list of LOCALEs to test against (default: a single locale determined by the Firebase Test Lab device catalog)
--log-httpLog all HTTP server requests and responses to stderr. Overrides the default *core/log_http* property value for this command invocation
--network-profile <PROFILE_ID>The name of the network traffic profile, for example --network-profile=LTE, which consists of a set of parameters to emulate network conditions when running the test (default: no network shaping; see available profiles listed by the $ {grandparent_command} network-profiles list` command). This feature only works on physical devices
--num-flaky-test-attempts <int>Specifies the number of times a test execution should be reattempted if one or more of its test cases fail for any reason. An execution that initially fails but succeeds on any reattempt is reported as FLAKY. + The maximum number of reruns allowed is 10. (Default: 0, which implies no reruns.) All additional attempts are executed in parallel
--obb-files <OBB_FILE>A list of one or two Android OBB file names which will be copied to each test device before the tests will run (default: None). Each OBB file name must conform to the format as specified by Android (e.g. [main|patch].0300110.com.example.android.obb) and will be installed into <shared-storage>/Android/obb/<package-name>/ on the test device
--orientations <ORIENTATION>The device orientation(s) to test against (default: portrait). Specifying 'default' will pick the preferred orientation for the app. _ORIENTATION_ must be one of: *portrait*, *landscape*, *default*
--os-version-ids <OS_VERSION_ID>The list of OS_VERSION_IDs to test against (default: a version ID determined by the Firebase Test Lab device catalog)
--other-files <DEVICE_PATH=FILE_PATH>A list of device-path=file-path pairs that indicate the device paths to push files to the device before starting tests, and the paths of files to push. + Device paths must be under absolute, approved paths (${EXTERNAL_STORAGE}, or ${ANDROID_DATA}/local/tmp). Source file paths may be in the local filesystem or in Google Cloud Storage (gs://...). + Examples: + ``` --other-files /sdcard/dir1/file1.txt=local/file.txt,/storage/dir2/file2.jpg=gs://bucket/file.jpg ``` + This flag only copies files to the device. To install files, like OBB or APK files, see --obb-files and --additional-apks
--page-size <PAGE_SIZE>Some services group resource list output into pages. This flag specifies the maximum number of resources per page. The default is determined by the service if it supports paging, otherwise it is *unlimited* (no paging). Paging may be applied before or after *--filter* and *--limit* depending on the service
--performance-metricsMonitor and record performance metrics: CPU, memory, network usage, and FPS (game-loop only). Enabled by default, use --no-performance-metrics to disable
--project <PROJECT_ID>The Google Cloud Platform project ID to use for this invocation. If omitted, then the current project is assumed; the current project can be listed using `gcloud config list --format='text(core.project)'` and can be set using `gcloud config set project PROJECTID`. + `--project` and its fallback `core/project` property play two roles in the invocation. It specifies the project of the resource to operate on. It also specifies the project for API enablement check, quota, and billing. To specify a different project for quota and billing, use `--billing-project` or `billing/quota_project` property
--quietDisable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1
--record-videoEnable video recording during the test. Enabled by default, use --no-record-video to disable
--results-bucket <RESULTS_BUCKET>The name of a Google Cloud Storage bucket where raw test results will be stored (default: "test-lab-<random-UUID>"). Note that the bucket must be owned by a billing-enabled project, and that using a non-default bucket will result in billing charges for the storage used
--results-dir <RESULTS_DIR>The name of a *unique* Google Cloud Storage object within the results bucket where raw test results will be stored (default: a timestamp with a random suffix). Caution: if specified, this argument *must be unique* for each test matrix you create, otherwise results from multiple test matrices will be overwritten or intermingled
--results-history-name <RESULTS_HISTORY_NAME>The history name for your test results (an arbitrary string label; default: the application's label from the APK manifest). All tests which use the same history name will have their results grouped together in the Firebase console in a time-ordered test history list
--robo-directives <TYPE:RESOURCE_NAME=INPUT>A comma-separated (`<type>:<key>=<value>`) map of `robo_directives` that you can use to customize the behavior of Robo test. The `type` specifies the action type of the directive, which may take on values `click`, `text` or `ignore`. If no `type` is provided, `text` will be used by default. Each key should be the Android resource name of a target UI element and each value should be the text input for that element. Values are only permitted for `text` type elements, so no value should be specified for `click` and `ignore` type elements. + To provide custom login credentials for your app, use + --robo-directives text:username_resource=username,text:password_resource=password + To instruct Robo to click on the sign-in button, use + --robo-directives click:sign_in_button= + To instruct Robo to ignore any UI elements with resource names which equal or start with the user-defined value, use + --robo-directives ignore:ignored_ui_element_resource_name= + To learn more about Robo test and robo_directives, see https://firebase.google.com/docs/test-lab/android/command-line#custom_login_and_text_input_with_robo_test. + Caution: You should only use credentials for test accounts that are not associated with real users
--robo-script <ROBO_SCRIPT>The path to a Robo Script JSON file. The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. You can guide the Robo test to perform specific actions by recording a Robo Script in Android Studio and then specifying this argument. Learn more at https://firebase.google.com/docs/test-lab/robo-ux-test#scripting
--scenario-labels <LABEL>A list of game-loop scenario labels (default: None). Each game-loop scenario may be labeled in the APK manifest file with one or more arbitrary strings, creating logical groupings (e.g. GPU_COMPATIBILITY_TESTS). If *--scenario-numbers* and *--scenario-labels* are specified together, Firebase Test Lab will first execute each scenario from *--scenario-numbers*. It will then expand each given scenario label into a list of scenario numbers marked with that label, and execute those scenarios
--scenario-numbers <int>A list of game-loop scenario numbers which will be run as part of the test (default: all scenarios). A maximum of 1024 scenarios may be specified in one test matrix, but the maximum number may also be limited by the overall test *--timeout* setting
--sort-by <FIELD>Comma-separated list of resource field key names to sort by. The default order is ascending. Prefix a field with ``~'' for descending order on that field. This flag interacts with other flags that are applied in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*
--test <TEST>The path to the binary file containing instrumentation tests. The given path may be in the local filesystem or in Google Cloud Storage using a URL beginning with `gs://`
--test-package <TEST_PACKAGE>(REMOVED) The Java package name of the instrumentation test. By default, the test package name is parsed from the APK manifest. + Flag --test-package has been removed
--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)
--test-targets <TEST_TARGET>A list of one or more test target filters to apply (default: run all test targets). Each target filter must be fully qualified with the package name, class name, or test annotation desired. Any test filter supported by `am instrument -e ...` is supported. See https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner for more information. Examples: + * `--test-targets "package com.my.package.name"` * `--test-targets "notPackage com.package.to.skip"` * `--test-targets "class com.foo.ClassName"` * `--test-targets "notClass com.foo.ClassName#testMethodToSkip"` * `--test-targets "annotation com.foo.AnnotationToRun"` * `--test-targets "size large notAnnotation com.foo.AnnotationToSkip"`
--timeout <TIMEOUT>The max time this test execution can run before it is cancelled (default: 15m). It does not include any time necessary to prepare and clean up the target device. The maximum possible testing time is 45m on physical devices and 60m on virtual devices. The _TIMEOUT_ units can be h, m, or s. If no unit is given, seconds are assumed. Examples: - *--timeout 1h* is 1 hour - *--timeout 5m* is 5 minutes - *--timeout 200s* is 200 seconds - *--timeout 100* is 100 seconds
--trace-token <TRACE_TOKEN>Token used to route traces of service requests for investigation of issues. Overrides the default *core/trace_token* property value for this command invocation
--type <TYPE>The type of test to run. _TYPE_ must be one of: *instrumentation*, *robo*, *game-loop*
--use-orchestratorWhether each test runs in its own Instrumentation instance with the Android Test Orchestrator (default: Orchestrator is not used, same as specifying --no-use-orchestrator). Orchestrator is only compatible with AndroidJUnitRunner v1.0 or higher. See https://developer.android.com/training/testing/junit-runner.html#using-android-test-orchestrator for more information about Android Test Orchestrator
--user-output-enabledPrint user intended output to the console. Overrides the default *core/user_output_enabled* property value for this command invocation. Use *--no-user-output-enabled* to disable
--verbosity <VERBOSITY>Override the default verbosity for this command. Overrides the default *core/verbosity* property value for this command invocation. _VERBOSITY_ must be one of: *debug*, *info*, *warning*, *error*, *critical*, *none*