Mobile-test-Automation

Introduction

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.

Mobile Automation Strategy

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.

Selecting the Automation Framework

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:

  1. Appium Framework

  2. Robot Framework

Test Beds for Test Runs

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: Appium Library

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.

Appium Library

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.

Case Study

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.

[See Also: Native vs Cross Platform for Application Development]

Application under Test (AUT)

Now I am going to take a simple hybrid app, the default email app for the Android platform, involving the following cases:

  1. Launch Default Email Application and check if launched correctly.

  2. Switch to correct Inbox correctly

  3. Verify the Mail is sent properly

Software/Hardware Involved

  1. Real Device or Emulator ( Genymotion ) ( Preferably Android 4.2.2 or higher)

  2. Robot Framework (http://robotframework.org/)

  3. Appium Library of Robot framework

  4. Python 2.7.5 or higher

  5. Appium 1.2.4.1 or higher

  6. Jenkins

Key Components of Robot Framework

Jenkins: Continuous Integration

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.

Mobile testing services

Test suite: 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.

Software testing services

Pybot

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.

Robot Framework Code Base

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 Server

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]

Real Device or Emulators

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.

Reports/Logs

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.

Test Report

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.

Cloud Software testing services

Test Logs

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.

test logs

Jenkins: Robot Plug-in Report

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.

jenkins report 1

jenkins report 2

Zymr Mobile Automation Framework

zymr mobile automatic framework

There is no doubt that test automation is a useful way to save time and effort. Using the robot framework is a great way to help improve your mobile application development process.

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.


Introduction Package

Lead Software Engineer - QA, Zymr, Inc.

3 comments

  1. i was looking for same topic. Thanks for sharing

  2. Thanks for sharing your views. Let our team know if you need any further assistance

  3. This article does a great job by telling us the information regarding Mobile Test Automation Using Robot Framework. whole concept were explained very clearly. The article was very informative. Thanks for sharing such an informative article with us. Lot of study has gone into this and I wish the author All The Best and Big Thanks to share your work.

Leave a Reply

© 2018, Zymr, Inc. All Rights Reserved.| LEGAL DISCLAIMER | PRIVACY POLICY | COOKIE POLICY
Close

Request For My Information

 
Close

Request For Account Deletion

Close

Request For Information Deletion

Close

General Request / Query To DPO