In part 1 of this post I looked at how to create Robotium instrumentation tests for an Android application so that it could be tested on Amazon’s Device Farm. At the end of that post, we had two apk files: the application and the tests. The process of testing on the AWS device farm is simple and effective.
You will need an AWS account, you can sign up and get a free usage tier here. Once you account is configured, head on over to the Device Farm and testing can commence.
Tests are organized into projects. Projects can contain tests to be run on iOS, Android and Fire OS, they just provide a mechanism to allow you to organize your work.
At the heart of a Device Farm test is a Test Run. Here, you upload the code under test, the test code and select which devices to test against.
It’s wizard driven, so as soon as you click the button to define a Test Run, you are prompted to choose an apk file from your local drive.
Once uploaded, Device Farm performs a brief analysis of the manifest of the Android APK and reports it’s findings.
Device Farm presents a list of the test types it supports. At the time of writing, several of these were still in the preview phase of development. For all of the tests except Built-In: Fuzz you have to supply test code. Built-In: Fuzz simulates random user interactions. In our case, we selected the Instrumentation test type and uploaded the Robotium code we generated previously.
You now need to specify which devices to test against. All users are offered the opportunity to use the built-in Top Devices pool which consists of 5 devices. To use other devices (and there are many), you will need to define your own device pools. You need Amazon to approve your use of these devices: simply a matter of filling in a form and waiting a few days for a response.
The last edit screen in the wizard allows the specification of the state of the device. There are two main areas to configure: the physical state of the device (network connection, location, enabled hardware) and the addition of pre-installed apps and data.
These settings will be applied as part of the initialization of the devices on which our app is to be tested.
As with other AWS wizards, we get to review our chosen settings before the tests are run.
It takes several minutes for the tests to run, dependent on the complexity of the tests and the availability of the devices in the device pool. Eventually, you will get either a green bar indicating your tests have all passed.
Or, some tests will fail
Simply clicking on the results lines shown in the screen-shots above takes you to the details of the test:
Detailed results for each device are then available
The tabs at the top allow you to access recorded screenshots:
And, perhaps most important of all the output files from the tests along with the captured LogCat output as the test proceeded.
Learning Tree whose generosity allows me to write these posts have a couple of great courses that might be of interest to you: course 4711 provides a great overview of the new features in Amazon’s Web Service suite including Device Farm. For more on Android Development, take a look at course 2771 Android Application Development & Programming