Skip to content

Instantly share code, notes, and snippets.

@qwertyfinger
Created March 27, 2019 03:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qwertyfinger/0a9b6a5fc8a27c71cd66ecb70879b0dd to your computer and use it in GitHub Desktop.
Save qwertyfinger/0a9b6a5fc8a27c71cd66ecb70879b0dd to your computer and use it in GitHub Desktop.
#!/bin/sh
BUILD_ID=$1
TEST_DIR=$2
test_apk() {
RESULTS_DIR=$1_${BUILD_ID}
gcloud firebase test android run \
--type instrumentation \
--app $2 \
--test $3 \
--device model=walleye,version=28,locale=en_US,orientation=portrait \
--timeout 20m \
--results-dir=${RESULTS_DIR} \
--environment-variables coverage=true,coverageFile=/sdcard/tmp/code-coverage/connected/coverage.ec \
--directories-to-pull=/sdcard/tmp \
--no-record-video \
--no-performance-metrics
TEST_RESULT=$?
# Make result dir
mkdir -p "$TEST_DIR/$RESULTS_DIR"
# Pull down test results
gsutil -m cp -r -U "gs://test-lab-{your-bucket-id}/$RESULTS_DIR/*" "$TEST_DIR/$RESULTS_DIR"
return ${TEST_RESULT}
}
test_apk \
"app" \
"app/build/outputs/apk/debug/app-debug.apk" \
"app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment