The first thing we will need to do is to install gcloud on our machine so we can run the tests from command line either locally or on a CI machine.



$ exec -l $SHELL

$ gcloud init $ curl https://sdk.cloud.google.com | bash$ exec -l $SHELL$ gcloud init

Check out https://cloud.google.com/sdk/install#interactive for more details.

The second thing we need to do is to install gcloud beta components because testlab is still in beta.

$ gcloud components install beta

A quick test of our installation is always a good idea.

$ gcloud firebase test android models list

The next step is building our app, the following assumes that our UI tests flavor is called debug.

$ cd <AppFolder> $ ./gradlew :app:assembleDebug

$ ./gradlew :app:assembleDebugAndroidTest

You can check the out apks by running:

$ open app/build/outputs/apk/

Now the final and most important, running our UI tests.