Mobile application testing refers to the specialised process with which the application software developed by software engineers can be tested for functionality, security, usability and consistency. The testing of mobile apps can be automated or manual. They may be pre-installed with a fresh handset, or be installed from software distribution platforms and online repositories launched by network service providers.
Security testing is considered the most important factor of mobile apps testing, because with banking and financial services going online, mobile apps need to be secure to prevent malicious attacks.
Types of mobile application testing
Today, since almost every service is accessible via a mobile phone, there are a number of parameters on which mobile apps are tested, as any small error can ruin the reputation of mobile app providers.
The following are the testing techniques used for rigorous analysis of mobile apps.
Usability testing: This tests the user interface, and ensures that the mobile app is easy to use and provides a good user experience. Usability testing is carried out to verify if the application is achieving its goals and getting a favourable response from users. This is important, as the usability of an application is the key to its commercial success.
Compatibility testing: This tests the app on multiple platforms so that there is no problem linked to compatibility or portability. The testing of the application on multiple mobile devices, Web browsers, screen resolutions and operating system versions is done based on requirements.
Interface testing: Interface testing is concerned with the analysis and testing of menus, sub-menus, menu options, buttons, hyper links, bookmarks, history, settings, navigation flow and other related components of the application.
Services testing: This tests the mobile application under different modes, including online and offline. With the help of these tests, the predictive behaviour of the mobile app is analysed.
Testing the system resources: In this testing technique, aspects like memory usage, auto deletion of temporary files, and issues linked to the growth of the local database are tested. In the process, the battery or power consumption issues are also analysed by the test engineers.
Performance testing: This tests the performance or efficiency of the mobile app by transforming the network connection from 2G or 3G to Wi-Fi, sharing documents, gauging battery consumption and other aspects. The mobile app is tested under different scenarios so that its behaviour can be analysed under certain conditions such as low battery, bad network coverage, low available memory, simultaneous access to the applications server by several users, and other conditions. The performance of an application can be affected by whats happening on the server side and client side. So performance testing is carried out to check both.
Operational testing: This is done to test backups and recovery plans when the battery goes down. Or if data gets lost while upgrading to a new application bought from the store.
Security testing: These tests are done to validate whether the mobile app is fully secured against cross site scripting, SQL injection, session hijacking, cookie stealing and other related attacks.
Functional testing: Functional testing makes sure that the application is working as per requirements. Many of the tests conducted for this are driven by the user interface and call flows.
Laboratory testing: Laboratory testing is usually done by network carriers, by simulating the entire wireless network. This test is performed to find out any glitches when a mobile application uses voice and/or data connections to perform some functions.
Testing for memory leakages: Memory leakage occurs when a program or mobile app is unable to manage the memory allocated to it, resulting in poor performance of the app and the overall slowing down of the system. As mobile devices have significant constraints on available memory, memory leakage testing is important for the proper functioning of any application.
Interrupt testing: Mobile apps face different interruptions like incoming calls, and problems related to battery power or network coverage. Interrupt testing ensures the avoidance of these issues.
Different types of mobile phone interrupts are: incoming and outgoing SMS and MMS, incoming and outgoing calls, incoming notifications, battery removal, cable insertion and removal for data transfer, network outage and recovery, media player being turned on or off, and the devices power cycle.
Installation testing: Many mobile apps come pre-installed on the mobile phone, whereas others have to be installed from the store. Installation testing ensures that the installation process goes smoothly without any problems for the user. This testing process covers installation, updation and uninstallation of the application.
Use of emulators
Currently, almost every organisation makes use of emulators as well as simulators in its research and development cells. Using such technologies, the look and feel of the device or application can be experienced without using the actual infrastructure. With this method, there is no damage or maintenance of actual infrastructure, because everything is tested virtually. The use of emulators is extremely useful in the initial stages of development, as they allow quick and efficient checking of the app. An emulator is a system that runs software from one environment in another environment without changing the software itself. It imitates the features and behaviour of the real or actual system to be used.
Some mobile emulators are listed below:
- Device emulator: Packaged and provided by device manufacturers
- Browser emulator: Used to simulate mobile browser environments
- Operating systems emulator: Apple provides emulators for iPhones, Microsoft for Windows phones, and Google for Android phones
Challenges in mobile app testing
Mobile app testing can be challenging because of the following factors.
The sheer variety of mobile devices: Mobile devices differ in screen sizes, input methods (QWERTY, touch or normal) and have different hardware capabilities.
Diverse mobile platforms/OSs: There are many different mobile operating systems in the market. The major ones are Android, iOS, BREW, BREWMP, Symbian, Windows Phone and BlackBerry (RIM). Each operating system has its own limitations. Testing a single application across multiple devices running on the same platform and then on every platform, poses a unique challenge for testers.
Mobile network operators: There are over 400 mobile network operators in the world, of which some are CDMA and some are GSM-based, while others use less common network standards like FOMA and TD-SCDMA. Each network operator uses a different kind of network infrastructure and this limits the flow of information.
Scripting: The variety of devices being used makes executing the test script (scripting) a key challenge. As devices differ in keystrokes, input methods, menu structure and display properties, a single script does not function on every device.
Mobile application testing tools
Using specific as well as specialised tools, mobile apps can be tested on multiple parameters and dimensions.
The following tools can be downloaded and used to test mobile applications that run on the iPhone.
Clang Static Analyzer: URL: http://clang-analyzer.llvm.org
XCode: URL: https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/UnitTestYourApp/UnitTestYourApp.html
A wide range of tools can be downloaded and used for testing mobile applications that run on Android. Some of these are listed here.
Android Lint: This is integrated with the Eclipse IDE for Android app testing. This software highlights the potential bugs and performance problems in the app. The Android Lint tool is a static code analysis tool that checks the Android project source files for potential bugs. It also optimises and improves the apps performance, usability, security, accessibility and internationalisation features.
FindBugs: This is an open source code library for static analysis. It is a special plugin for Android-specific coding, and is a static code analysis tool for finding bugs in standard Java programs.
Appium: Appium is an open source test automation framework for use with native and hybrid mobile apps. It works for iOS and Android apps using the WebDriver JSON wire protocol. Appium is cross-platform and allows the writing of tests for multiple platforms (iOS, Android) using the same API. It enables code to be reused between iOS and Android test suites.
Native apps are those written using the iOS or Android SDKs. Mobile Web apps are those accessed using a mobile browser (Appium supports Safari on iOS and Chrome, or the built-in Browser’ app on Android). Hybrid apps have a wrapper around a webviewa native control that enables interaction with Web content. Projects like Phonegap make it easy to build apps using Web technologies that are then bundled into a native wrapper, creating a hybrid app.
Robotium: Robotium is the Android test automation framework that offers full support for native and hybrid applications. Robotium makes it easy for engineers to write powerful and robust automatic black-box UI tests for Android applications. With the use of Robotium, the test case developers can write function, system and user acceptance test scenarios, spanning multiple Android activities.
The following are the features of Robotium:
- It can test any type of Android app – native and hybrid.
- Detailed knowledge of the application under test is not required.
- The framework handles multiple activities of Android automatically.
- Less time consuming when writing solid and complex test cases.
- Readability of test cases is greatly improved, compared to standard instrumentation tests.
- Test cases are more efficient and robust due to the run-time binding to UI components.
- Speedy and accurate test case execution.
- Integrates easily with Maven, Gradle or Ant to run tests as part of continuous integration.
MonkeyRunner: This tool provides an API for writing the programs that can control the Android device or emulator. Using MonkeyRunner, the test engineer can write a Python program that installs an Android application or test package, runs it, sends keystrokes, takes screenshots of its GUI, and stores the screenshots on the workstation.
The MonkeyRunner tool was developed primarily to test applications and devices at the functional or framework level and to run unit test suites, but test engineers are free to use it for other purposes.
This software allows test engineers to perform functional app testing by providing the API for managing the device. MonkeyRunner makes use of Jython, an implementation of Python that uses the Java programming language. Jython allows the MonkeyRunner API to interact directly and easily with the Android framework. With the use of Jython, the test engineer can use Python syntax to access the constants, classes, and methods of the API.
MonkeyRunner does not have advanced features like Robotium. The tool has three modules:
- MonkeyRunner, to manage connections to the devices. It allows users to create test scripts with Python or just record and play them.
- MonkeyDevice, to manage apps and events.
- MonkeyImage, to gather screenshots for advanced test reporting.
The MonkeyRunner tool provides the following unique features for Android testing:
- Multiple device control: The MonkeyRunner API can apply one or more test suites across multiple devices or emulators. Test engineers can attach all the devices or start up all the emulators at once, connect to each one, in turn, programmatically, and then run one or more tests. They can also start up the emulator configuration programmatically, run one or more tests, and shut down the emulator.
- Functional testing: The MonkeyRunner software can execute an automated start-to-finish test of any Android application. Test engineers can provide the input values with keystrokes or touch events, and view the results as screenshots.
- Regression testing: The software can test the apps stability by executing an app and comparing its output screenshots to a set of screenshots that are known to be correct.
- Extensible automation: As MonkeyRunner is an API toolkit, test engineers can develop an entire system of Python-based modules and programs for controlling Android devices. Besides using the MonkeyRunner API itself, engineers can use the standard Python OS and sub-process modules to call Android tools such as Android Debug Bridge.
Sikuli: This is another open source tool that is used for automating GUI testing. It is an open cross-platform visual platform for creating the scripts, and is oriented towards programming the graphic interface with the help of images or screenshots. Sikuli is a tool that can supplement the testing toolbox. The scripts the test engineer creates with this tool are in the Sikuli Script language, which has a Python (Jython) extension.
Calabash: Calabash enables test engineers to write and execute automated acceptance tests for mobile apps. It is cross-platform, and supports Android and iOS native apps. Calabash is free, being distributed as open source software, with the company Xamarin backing and developing it.