Skip to main content

Firebase Test Lab for Android

Appcircle is integrated with the Firebase Test Lab for continuous testing. Your app can be built in Appcircle and directly deployed to the Firebase Test Lab to run automated tests.

Prerequisites

The necessary workflow steps to execute before running the Firebase Test Lab for Android workflow step, along with their respective reasons, are listed in the table below.

Prerequisite Workflow StepDescription
Android Build for UI TestingThe Android Build for UI Testing step must be executed to obtain the necessary Android application outputs for processing.

In addition to the steps you need to run on Appcircle, there are also adjustments you need to make on the Firebase Test Lab side. These adjustments can be made as follows:

1. Setting Up a Firebase Project and a Service Account

To begin with the Firebase Test Lab, you need to have an associated Firebase Project, which is created in the Firebase console. Go to the console, press the Add Project button, and specify the project name and other settings:

Once your project is created, go to the Google Cloud Platform console to create a service account. Press the Create Service Account button and follow the prompts to create a service account with the Editor role:

After the service account is created, click on the three-dot () menu next to the service account and press Create Key.

Select the key format as JSON and download the created key. This key will be used by Appcircle to deploy apps to the Firebase Test Lab.

As the final step, go to the Google Developers Console API Library page and find and enable the following APIs:

  • Google Cloud Testing API
  • Cloud Tool Results API.

2. Build Workflow Configuration for Firebase Test Lab

To utilize the Firebase Test Lab in your builds, open the workflow editor and add the Firebase Test Lab for Android step after the build or sign steps. If you want to run instrumentation tests, also add the Android Build for UI Testing step before the Firebase Test Lab for Android step.

caution

If you want to run robo tests, it is highly recommended not to add the Android Build for UI Testing step.

If you want to use the UI Test Build output or the Signed Build output in the Firebase Test Lab, add any of these steps before the Firebase Test Lab for Android step and take note of the output path of these steps. You will need this environment variable for testing configuration.

Input Variables

For each component, specific input variables are required for its operation on your system. The input variables necessary for the Android Build for UI Testing are as follows:

Variable NameDescriptionStatus
$AC_FIREBASE_PROJECT_IDSpecifies the name of the Firebase project created.Optional
$AC_FIREBASE_KEY_FILESpecifies the name of the key file uploaded as an environment variable ($ is required before the key name).Optional
$AC_FIREBASE_TEST_TYPESpecifies the test type. robo and instrumentation are supported.Required
$AC_FIREBASE_BUCKET_NAMESpecifies the bucket name to store the test results in a Google Cloud Storage bucket.Optional
$AC_APK_PATHThe default value is the APK produced by the Android Build or Android Build for UI Testing step. You can specify a different environment variable to use the APK files produced in other steps.Optional
$AC_TEST_APK_PATHSpecify the environment variable as the path of the APK build for UI testing. The default value is the APK produced by the Android Build for UI Testing step.Optional
$AC_FIREBASE_EXTRA_ARGSFirebase Test Extra Arguments (e.g., --timeout=3m). For further configuration of the test run, please refer to the Google Cloud CLI documentation.Optional

Once everything is set up, press save to save your step configuration. Then you can configure and run your build just like any other app.

Output Variables

This step does not produce any output as a variable. However, after your build is done, you can view the results of the Firebase Test Lab for Android step in the build logs.

The full details of the tests are accessible in the Firebase console and in your Google Cloud Storage bucket for analysis.


To access the source code of this component, please use the following link:

Preview of GitHub - appcircleio/appcircle-android-firebase-test-lab-component