Firebase Test Lab

Our CLI tool has special tooling to handle Firebase Test Lab, in particular on Android. This can be used to run tests for screenshot-tests-for-android or Shot.

Setting up Firebase test run

We assume you already set up running instrumentation tests on Firebase. (If you need help, feel free to contact us).

At this point you need to make sure your call into Firebase Test Lab also pulls all the screenshots that were generated during the run. As part of your CI script, you can use something like the following:

    cd ~/project && sudo gcloud firebase test android run \
         --app ./build/outputs/apk/debug/project-debug.apk \
         --test ./build/outputs/apk/androidTest/debug/project-debug-androidTest.apk \
         --results-bucket cloud-test-${GOOGLE_PROJECT_ID} \
         --directories-to-pull /sdcard/screenshots/<package-name-of-instrumentation-apk> \
         --device-ids Pixel2 \
         --os-version-ids 27

Screenshotbot provides a script to process these screenshots:

      curl | sh

You can now use the recorder to upload the screenshots to Screenshotbot:

    ~/screenshotbot/ --dir ${CIRCLE_ARTIFACTS}/*/*/artifacts/ \
      --channel <channel-name>    \
      --metadata ${CIRCLE_ARTIFACTS}/*/*/artifacts/metadata.xml \

Choose the channel name appropriately, if you’re using buck it could the Buck target to the instrumentation test. If you’re using multiple gradle repositories, it could be the Github URL to the gradle repository, etc. Each channel is monitored independently.

Full Example

Here’s a full working example.

Ready to get started?

Sign up or contact us.