JUSTIN BROUGHTON: InFirebase Test Lab, you use real and virtual devices to test your app. These devices run in a Google data centre.
They contain the latest APIs and have customizable locale settings, enabling you to test your app as people around the world would use it.
You can let TestLab test your app for you, which is called Robo testing, or you can create Espresso Instrumentation tests in Android Studio and have Test Lab run them. I will look at both of these in more detail shortly. You can also run Robo tests from the Google Play Console pre-launch report each time you upload an app to the closed or open test tracks. The pre-launch report offers the same Robo test features as Firebase Test Lab.
The benefit of TestLab comes from being able to run tests on a wider range of devices with more options, as well as to be able to run your own instrumentation tests. OK, let’s take a close look at Robo tests.
When you run a Robo test, an application crawler analyzes the structure of your app’s UI and then explores it methodically, simulating user activity.
Robo tests capture log files, performance data, screenshots of unique screens, as well as annotated video to show you the simulated user actions it performed. These logs and performance data and screenshots and videos can help you determine the cause of crashes and find issues with your app’s UI.
You can also use Robo tests to validate bug fixes and test for regressions. This is because Robo testing simulates the same user activities in the same order each time it tests your app. There is also an option to control Robo tests. For example, you may want to test a common user journey or start the crawler at a specific screen. You do this using a Robo script.
You create these scripts in Android Studio, simply select Firebase from the tools menu, then click Record Robo Script, and use it to guide Robo test.
Now record and upload your scripts to Firebase Test Lab. In addition to a regular crawl from the beginning of your app, you can test up to three deep links. Here, the crawler follows the link and then exercises your app for an additional 30 seconds, reporting on anything it finds in the same way as it does for the main test.
Robo test can also sign into your app using either a Google login or your own custom login credentials. Robo tests are a great way to get started with app testing with minimal effort on your part.
However, for a truly high-quality app, you will almost certainly need to create your own instrumentation test which Firebase Test Lab can then run for you. You can create these test scripts in Android Studio either manually, or you can record them using Record EspressoTest on the run menu.
You record your test script by interacting with your app when done saving your test script locally. For more details on recording test scripts, check out the Android Tool Time video, Create UI Tests withEspresso Test Recorder.
There is a link in the video details. To get the most out of Espresso tests, the key is to modularize your tests, creating test snippets for the functions used in the majority of your tests, such as logging in or filling out a search form. You can then invoke these snippets from your test scripts whenever you need these common functions.
Then as you update your app, use the Espresso Test Recorder to quickly rerecord the snippets where there have been changes. You can then run these test scripts locally or load the suite of tests into your continuous integration server and get the assurance that you haven’t broken your app at each update. And of course, you can upload the test scripts to Firebase Test Lab.
You can then choose to run the tests on a selection of over 50virtual and physical devices, many of them available with a range of Android versions. Other options include testing your app in different languages or screen orientations and more. You can also run your tests in Firebase Test Lab from your continuous integration server.
You can find details on how to do this from the link in the video description. Espresso TestRecorder enables you to quickly and easily create tests for all parts of your app. You can then use the features of a continuous integration server, the pre-launch report, and Firebase Test Lab to automate your testing, improving your app quality, while freeing your time to focus on development.
To find out about this and other features and get tips to grow your app or game business, check out the Playbook app, available on Google Play.