How to run Firebase test lab automation tests on Android release builds

Andres Sandoval
2 min readDec 26, 2022

Tutorial shows how to run Espresso automation test on release builds.

By default Android projects are configured to run on debug builds, to be able to run the tests on release builds we need to add a configuration to our build.gradle file. Add below snippet to your Android project.

  1. Using Android Studio change the build type to “Release”.
  2. Inside the file build.gradle add ```testBuildType ‘release’ ```
android {
testBuildType "release"
}

3. The above change will add the dir folder ```code/AndroidTest ``` to your release build path.

4. Clean and build.

5. Run tests.

6. The tests now run on the release build, and will generate the release test APKs:

app-release-androidTest.apk and app-release.apk (sign with release key)

7. Go to firebase Test lab. And upload the TestAPK and the Release APK.

8. Run tests. Happy testing :)

Thanks for spending your time reading it and let me know if I’m wrong somewhere or if there’s something that could do differently or better. I’m open to your feedback 🙌🏻

-Andres

References:

https://console.firebase.google.com/u/0/project/project-7597674979231557123/testlab/histories/bh.bd20840b9c1c3f79

--

--