Flutter integration test with Firebase Test Lab & Github Actions

Adam Zapel
2 min readApr 1, 2021

--

In this tutorial, you will learn how to run using the new integration_test package. We’re going to execute them with Firebase Test Lab and GitHub Actions CI/CD so that you can be fully confident that every piece of code you commit to a repository passes the tests on multiple devices, OS versions, screen sizes, orientations and locales.

Step 1:

Create the GCP ServiceAccount Key for your project.

To get this key, go to this link.

You will need service account json key from Google Cloud Console, with role: Editor, for your project.

Step 2:

Need to convert this GCP ServiceAccount Key JSON into a Base64 string to use it inside GitHub.

Install openssl, for Windows: https://tecadmin.net/install-openssl-on-windows/, for Ubuntu: https://cloudwafer.com/blog/installing-openssl-on-ubuntu-16-04-18-04/, for Mac: https://yasar-yy.medium.com/installing-openssl-library-on-macos-catalina-6777a2e238a6

Go to the command-line, navigate to the directory where your JSON file is, and run openssl base64 -in key.json -out key.txt, now you can run code key.txt orcat key.txt to open the output file inside.

Go to your GitHub project > Settings, Secrets, New secret. The name is GCP_SA_KEY and paste the Base64 from your output file.

Step 3:

Set the GCP project ID, go to your GitHub project > Settings, Secrets, New secret. The name is GCP_PROJECT_ID.

Step 4:

Hook up the multiplatform Flutter integration tests to run as if they were native instrumentation tests on Android

Follow this guide: https://pub.dev/packages/integration_test#android-device-testing

Final YML to be used on GitHub Actions

More info here: https://flutter.dev/docs/testing/integration-tests

--

--