Welcome to Developer Device Platform Device Run, which allows you to run tests on physical and virtual Android devices and physical iOS devices in the cloud. This page describes commonalities between running Android and iOS tests. See Device Run for Android and Device Run for iOS for platform-specific steps.
To use this Google Cloud CLI, you will need to provide your Google Cloud project
ID. For a summary of commands, see: gcloud beta
device-run
Note these flags are required:
- Device: Specify a device using
--device:--device shiba-35or--device iphonese3-18-4 - Test: Specify the test APK or IPA using
--test:--test /path/to/test.apkor--test /path/to/test.ipa
The following configuration options are common to both Android and iOS tests.
Input and output Cloud Storage paths
- Custom Cloud Storage bucket: You can specify a custom Cloud Storage
bucket for inputs and outputs:
--bucket-name=my-custom-bucketIf you don't specify a Cloud Storage bucket using the--bucket-name=flag, the Google Cloud CLI will use a default bucket namedPROJECT_ID-devicerun. - Input files: When you specify a local path with the
--test,--additional-apps, or--xctestrun-fileflags, the Google Cloud CLI automatically copies it to your Cloud Storage bucket undergs://BUCKET_NAME/automation/inputs/DATE_TIME_FOUR_CHARS_SUFFIX/each time you execute the command., whereBUCKET_NAMEdefaults toPROJECT_ID-devicerun. - Cloud paths: Because uploading large files can be time-consuming, you can directly
reference them using their Cloud Storage
gs://paths to save upload time. - Result files: Output artifacts are uploaded to your Cloud Storage
bucket under
gs://BUCKET_NAME/automation/sessions/session-[SESSION_ID]/.
Synchronous and asynchronous runs
By default, the submit command is blocking (synchronous). It will wait for the test to complete and print a summary table of the results.
To submit the session and return immediately after uploading files to
Cloud Storage, add the --async flag:
Android
gcloud beta device-run sessions submit instrumentation \
--device shiba-35 \
--test ./ANDROID_TESTS.apk \
--async
iOS
gcloud beta device-run sessions submit xctest \
--device iphonese3-18-4 \
--test ./IOS_TESTS.zip \
--async
This returns a session ID immediately. You can then wait for it using the
sessions wait command:
gcloud beta device-run sessions wait SESSION_ID
The command will block until the job is completed.
Multiple devices
To run the same tests across multiple devices, provide the --device flag with
multiple device IDs separated by commas or with multiple --device flags, each
specifying a distinct device ID.
Android
gcloud beta device-run sessions submit instrumentation \
--device shiba-34,tokay-36 \
--test ./ANDROID_TESTS.apk
Or:
gcloud beta device-run sessions submit instrumentation \
--device shiba-34 \
--device tokay-36 \
--test ./ANDROID_TESTS.apk
iOS
gcloud beta device-run sessions submit xctest \
--device iphonese3-18-4,iphonese3-26-3 \
--test ./IOS_TESTS.zip
Or:
gcloud beta device-run sessions submit xctest \
--device iphonese3-18-4 \
--device iphonese3-26-3 \
--test ./IOS_TESTS.zip
Test timeout
Limit the execution duration of your test:
Android
gcloud beta device-run sessions submit instrumentation \
--device shiba-35 \
--test ./ANDROID_TESTS.apk \
--instrumentation-timeout=10m
iOS
gcloud beta device-run sessions submit xctest \
--device iphonese3-18-4 \
--test ./IOS_TESTS.zip \
--xctest-timeout=10m
The valid range is 1m to 1h and defaults to 5m.
What's next
Run an Android test or Run an iOS test with Developer Device Platform.