Skip to content

Instantly share code, notes, and snippets.

@nowshad-hasan
Last active July 1, 2019 09:21
Show Gist options
  • Save nowshad-hasan/615d645f7183a93aa0c2514448b2d5b3 to your computer and use it in GitHub Desktop.
Save nowshad-hasan/615d645f7183a93aa0c2514448b2d5b3 to your computer and use it in GitHub Desktop.
How to generate test apk for Firebase Test Lab?
You need to give two apks for testing on Firebase Test Lab. One is - 'main apk', another is 'test apk'. You can generate it easily but there are some other things you need to know. You can run the inidividual test file but can't make individual test apk for individual test files. All the test files under 'androidTest' folder make just one test apk. So, you need to remove all test files that you think, will fail before making 'test apk'. Then if you're sure about all the test files on the androidTest folder will pass, then you should check it on your local machine to test like on Test lab. Uninstall the older apk from your phone because on Test Lab, apk will be installed newly every time we run on that. Right click on 'androidTest' folder, then click on 'Run tests in ....'. It will run all the tests this folder has, thoroughly like Test lab. If it is passed, then you can prepare the apks for Test Lab. Here is the interesting part. For every test file you run (individual or folder selection), test apk is always generated on build/outputs/apk/androidTest/develop/debug folder (for all test file on the androidTest folder) and main apk is on build/outputs/apk folder. If you feel any problem for the main apk, manually build it from android studio Build -> Build Bundle/apk -> Build apk. You will find the apk on build/outputs/apk folder. Then go to https://console.firebase.google.com, select Test lab from the left navigation bar and will find every test you run till now. Click Run a test -> Run an instrumented test and select two of your apks (main and test apk). Then you will find a page for device selection. You can select the device list (real and virtual) from this page or previously made templates. Then click on Test on bottom of the page. Wait till the test is completed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment