e-testing Blog

Test Automation for Mobile

by Ewelina Matalowska



As with most development, developing mobile apps uses an agile way of working. Testing an app manually can be repetitive and time-consuming. In line with sprint based development, test automation for mobile has increased in popularity among app developers, speeding up their work processes and encouraging and better and more robust results.

In order to achieve compatibility between users and devices, the implementation of an agile development process that includes test automation as a part of the process, is required. It has been proven that test automation significantly adds value by enabling testing to be done, in parallel with other agile processes— for example, having tests run overnight as a part of Continuous Integration practices. By the next morning, the tests will have been executed and the latest results will be ready for review. Fixing an issue at an early stage can save time and money, allowing developers to finalise the product faster. Moreover, it results in better quality applications, with fewer bugs.

Test automation for mobile offers the possibility to test mobile apps in an instant and effective way. After tests have been automated, they can be repeatedly run, with precision and speed. In most cases, this will be the most cost-effective way for the regression testing of software products that have a long maintenance life. There are a lot of tools for the automation of tests on mobile platforms available, which we will cover later in this article.

The Implementation of Automation on Mobile
Automating tests for mobile testing can be a complex task. It requires thorough planning, preparation and market research for the right tool. All this is necessary for creating the most effective tests that will add value and provide a rapid return on investment.The steps to implement test automation of mobile applications are as follows:

  • Research the options – there are many tools on the market and it is important that software products are evaluated against testing needs and project expectations
  • Identify which tests can and should be automated – clearly determine what is in scope for mobile automation
  • Get the requirements right – formulate requirements for the automated tests, and the tools for automation
  • Try a few tools before you chose one – select and evaluate several available and seemingly suitable tools
  • Select the most suitable tool based on your – choose the one (or more) tools based on your results
  • Explain your choice to stakeholders – discuss the chosen automation tool with the other project parties, clarify the reason behind your choice and get approval
  • Proceed to development – framework based automation is a good approach, encouraging consistency, while making maintenance easier.

Different Approaches for Native, Hybrid and Web Apps
Native and hybrid apps are available from the app stores, whereas web apps are mobile-optimized webpages that look like an app. Both hybrid and web apps use HTML web pages, but hybrid apps use app-embedded browsers to render content, rather than using the browser installed on the device.
Native applications are inherently connected to the hardware and operating systems on which they are running. To meet the challenges of testing for native mobile applications, it is possible to test using emulators and simulators, but it is important to test on the physical devices, supported by the application under test. There are a number of advantages of native apps:

  • They offer the fastest, most reliable and most responsive experience to users
  • They can tap into the wider functionality of the device; including the camera, microphone, compass, accelerometer and use more complex gestures (swipe)
  • Publishers can make use of push-notifications, alerting users every time a new content item is published or when their attention is required

Unlike native mobile development, mobile applications using web technologies can support many mobile platforms. Web apps are sometimes designed to look and behave like apps, and can be ideal when the purpose is simply to make content or functionality available on a mobile device. i.e. Where an app is either not a good fit or is too expensive. Web apps use JavaScript, CSS, HTML5 and other languages. Developing a web app can be simple and quick; however, their simplicity is also their downside. Web apps are limited in what they can do effectively in terms of features, and they will generally require an Internet connection to function. They are also slower and less intuitive than native apps. Web apps are designed once for every platform and therefore will not look or behave like a real app on any one particular device.

Hybrid mobile applications combine the advantages of native and web applications. They are usually quicker to build (therefore, cheaper) and maintain than native apps. However, they could be called a “step-up” from browser-based web apps. The trade-off however, is that the app will not be as fast as a native app, as it still depends upon browser speed. The basic test concepts are as follows:

  • Tests work with native controls in hybrid applications in the same way they work with controls in regular mobile applications.
  • Tests work with web controls in a hybrid application in the same way you work with web controls.
  • Native app level tests are performed in the same way when working with Android or iOS applications

Selecting Automated Testing Tools for Mobile

Open Source Tools

Appium is a mobile test automation framework that works for all: native, hybrid and mobile-web apps on iOS and Android. Appium is a great choice for test automation frameworks, as it can be used for all of these different app types. In essence, Appium derives its roots from Selenium and it uses JSON Wire Protocol internally to interact with iOS and Android apps using Selenium’s WebDriver. It can control Safari and Chrome on mobile devices, allowing for testing on mobile web sites via these browsers, which represent the vast majority of the market.

UI Automator
This tool was recently developed by Google. It is a cross-platform test automation tool for native, hybrid and mobile web apps, tested on simulators (iOS, FirefoxOS), emulators (Android), and real devices (iOS, Android, FirefoxOS). Android support uses the Ui Automator framework for newer platforms and Selendroid for older Android platforms. UI Automator is able to interact with all kinds of software products, including system applications. This enables UI Automator to lock and unlock a smartphone or a tablet. Scripts created by this tool can be executed on many different platforms. It allows for the reproduction of complex, user action sequences. UI Automator also can utilize the external buttons of a device, such as buttons for going back, volume regulation and turning the device on or off.

Robotium is a test framework created to make writing robust automatic UI test cases for Android applications more simple. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities. Robotium tests can be run on both emulators and devices. Tests created by Robotium are written in Java.

The MonkeyRunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code. With MonkeyRunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation. The MonkeyRunner tool is primarily designed to test applications and devices at the functional / framework level, and for running unit test suites.

Enterprise Tools

Ranorex Studio is a testing tool used for both, iOS and Android, apps. The extensive Ranorex Library is modelled on the .NET framework, and is the bedrock of this widely popular automation tool. C# and VB.NET user codes can be generated from recorded test cases. The test cases can be written without writing any line of code. It simulates the user actions with the record and replay tool, into recording modules. The Ranorex API activates appropriate plug-ins depending on the platform. Ranorex Studio is supported on: Android 2.2 (API Level 8) and higher and IOS 5.1 and higher. One of the advantages of Ranorex is its detailed reports with screenshots. It can connect a smartphone or a tablet to internet via WiFi. Ranorex Studio enables an automated test engineer to create tests easily, just clicking the mouse. It allows elaborating additional program modules. The modules may be utilized during late development cycles for more complex test scenarios.

Eggplant has the ability to naturally conduct mobile testing using the iOS Gateway and Android Gateway agents, connecting directly to live mobile devices, or emulators. This allows it to fully test mobile apps on iOS, Android, Windows Phone, BlackBerry, and other mobile devices. EggPlant’s unique image-based UI testing approach is the natural way to test user-experience focused mobile applications, and massively reduces the effort of cross-device and cross-platform mobile software testing.

SeeTest performs tests on real devices and on emulators. It creates a test on one device, which can then run other devices, models and operating systems (e.g. Android test runs on iOS). SeeTest plugs into any testing environment – WebDriver (Selenium), HP UFT/QTP, JUnit, Microsoft Visual Studio and Python and other testing environments.
Moreover is can be implemented into any continuous integration environment – HP Quality Center (ALM), JIRA, Jenkins and other continuous integration environments.

Automated software testing is a solution to a problem faced by mobile app developers: how to produce high quality, robust and reliable software, with the ever-growing complexity of technology, while being under massive competitive pressure. Test automation for mobile can be a cost effective solution to this problem. It can provide the following advantages:

  • Increased efficiency of testing activities
  • Increased effectiveness of running tests
  • Reduced time in bringing an app to market

There is a wide selection of testing tools on the market, both open source and commercial. e-testing have a wide range of experience in tools from both domains and can assist organisations with selecting the right tool, or provide specialist expertise on projects when needed, in order to allow organisations to obtain greater efficiencies and return on investment. Please contact us for more information.


Subscribe to our RSS feed and get the latest updates in your inbox weekly