In the current technology era, it is normal to find about 4-5 new Android-based apps, uploaded to play store every week. Seeing competitors deliver apps so frequently creates pressure to deliver quality apps in a short span of time. During this limited time, mobile application development and testing of the business’ purpose should be achieved. With this pressure, there is a need to automate certain processes which can save time while providing a trusted output.
That being said, mobile test automation can save a lot of time and is always preferred over the entire manual test execution process. With much less effort, the verification of frequent test cases that manual execution requires can be automated, and more effort can be diverted to new features of the application, which are vulnerable and tend to have more defects.
Smartphone applications on Android or iOS platform are built as either hybrid, native or as a web app. Irrespective of the type of the application under testing, the selection strategy for automation framework does not vary up to large extent.
Here the challenge is to figure out the framework, which is either paid or has the capability to operate and reach every UI part of the application. Also, it should have different libraries that can communicate with the backend blocks of the application under testing, such as databases or web services.
Considering all the available types of applications in the market, the following frameworks are very promising for giving robust outputs:
The other challenge is to decide if the automation should be run on real devices or emulators. There are different third party software for emulators (Genymotion is a renowned example), which is promising for about 90% capabilities of the application, excluding some hardware and network dependent test cases to test. Choosing a real device depends on the Android version and hardware capabilities the AUT works on.
Robot framework is an open source framework which understands text, HTML formatted test case scripts, and has a keyword-driven methodology. It is a wrapper that is written over many frameworks with help of test libraries. These test libraries are selected according to the framework we choose to automate different types of application.
To drive the applications using an Appium framework, the robot framework’s Appium library is preferred. Here most of the capabilities of Appium are framed in form of keywords, which are easily understood by a tester who would want to read the scripts and understand what is exactly being performed in the particular test.
One of the renowned framework used for UI based automation for all three types of applications is Appium. To write robust automation framework using Appium, the robot framework library for Appium is recommended.
Going further in this post, I will walk you through a small case study done on a simple native application, with at least two test cases that are automated with a hybrid framework and using robot framework with an Appium library and python written utilities.
Note: The following ways can also be used with hybrid apps as well as web apps.
Now I am going to take a simple hybrid app, the default email app for the Android platform, involving the following cases:
Launch Default Email Application and check if launched correctly.
Switch to correct Inbox correctly
Verify the Mail is sent properly
Real Device or Emulator ( Genymotion ) ( Preferably Android 4.2.2 or higher)
Robot Framework (http://robotframework.org/)
Appium Library of Robot framework
Python 2.7.5 or higher
Appium 18.104.22.168 or higher
Jenkins is a continuous monitoring tool taking care of all the activities required to be run as part of complete automation end to end run. In the figure above, the role of Jenkins is to monitor the jobs that have been triggered to run the pybot tests.
Note: The Source Control Repository can also be used as Source for Jenkins Job to fetch the automation code repository.
The following image shows one of the Jenkins jobs, which triggers a test script file named Launch_email_app.txt.
This is a test script file which has 3 test cases under “Testcase” tag. Here the labels under this tag are considered as test methods by Robot framework. They are executed in sequential manner with top to bottom approach.
This is a robot framework module used to trigger the test scripts written in Robot framework format. Here the pybot reads the different framework files and executes the tests by performing different actions on the UI of apps.
The folder structure which comprises of all scripts that use Appium libraries to communicate and operate on the UI of the application. It comprises the different external libraries according to the need.
Appium is the open source engine that runs on Node.js and is interpreter used to drive the Appium library commands to perform actions on the UI of applications. It is necessary to be up and running during an interaction with UI of the application. To access the shell capabilities of the virtual device, the <adb> command with different parameters can be useful.
[See Also: Appium: iOS UI Software Test Automation]
The automation test scripts that needs to be run are mostly executed on virtual devices. The software Genymotion hosts different Android versions devices and runs in a virtual way. If the tests are specific to real devices, then without any changes in a single line of framework, they can be executed, provided the UI should have all the elements same as what is expected in the code.
The good part of using robot framework is its superior logging and reporting of features in the test case executions. The reports are generated in standard manner or they can be customized too. Please find some stills of these reports below.
This is a Report.html page which is automatically created after test runs. This page summarizes different test suites and their runs with pybot command that was triggered. These reports are interactive and can be drilled down to have detailed analysis of how the steps in test scripts went.
The following image shows the logs of the test case runs. Here is the detailed view and runtime values flowing in the variables. This approach saves time, avoiding the need to debug the code and then fix it.
Jenkins has a plug-in for robot framework, which shows interactive reports. We can drill down the reports to see details to analyse the health of the test cases running in consecutive job runs. The trend of every test case in every job run can also be analysed with this plug-in.
Everything you need to know about outsourcing technology development
Access a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.
This contact form is available only for logged in users.