Last time we automated a native iOS application with Telerik Mobile Testing. Now it's time for Android. Once again I will make it testable, develop a test plan, write and execute tests, and publish results to the Telerik Platform.
This case study uses a simple application called My First App, created from this Android Developers tutorial. A message is entered and sent on the main screen, and that message is displayed on the second screen.
|Main screen||Message entered||Second screen|
There are three Android widgets I plan to interact with: Button, EditText, and TextView. I plan to identify the Button based on its text property, so no additional steps are needed there. I can identify each TextView by index, and the EditText has a unique hint property.
|EditText hint property||Corresponding string value|
I created a duplicate testing flavor and added the Mobile Testing extension based on these instructions. Next I deployed the new testing build variant to a Samsung Galaxy S III.
There are two functional scenarios I want to test through automation:
Start with the main spec method:
Next comes the Query Repository. I defined the queries for all the elements here and assigned each to a variable.
Here I defined a few static variables used later in the test steps.
These steps perform the actions and verifications against the application's elements, which are referenced via the query repository. You'll see things like launching the app, tapping buttons, setting text, and verifying text views.
Finally comes the Test Suite. A suite is a group of tests, labeled with a friendly name, that calls the step repository. Each test is also labeled and contains steps, referenced by their friendly names from the step repository.
Based on the test plan I created earlier, I simply mix and match steps to create each test.
It's time to execute the tests via the Test Runner.
The Results tab loads when execution finishes. All tests passed!
I can additionally publish results to the Telerik Platform for storage and to share with colleagues, managers, and stakeholders.
That's it! The handy query and step repository method makes it easy to add new queries and tests when I add new elements and features to my application.
Anthony Rinaldi combines his experience in test automation and quality assurance with his passion for mobile devices and platforms. He is an avid CrossFitter, soccer player, and music fan.
Subscribe to be the first to get our expert-written articles and tutorials for developers!