WavebreakmediaMicro - Fotolia
Smartphones have plenty of great capabilities, allowing users to multitask like never before. This is excellent for a consumer, but for the tester it means coming up with new ways of testing. For example, in the middle of working on a mobile application you get interrupted by a phone call or text message. Will your application be able to operate as expected once you get back to it? Interrupt testing can be time-consuming when done manually, but using tools to simulate interruptions can lighten the load for testers. Let's take a closer look at interrupt testing, challenges and tools for mobility applications.
Types of interrupts
Interrupt testing is one of the most crucial types of testing for mobile applications, but because this type of testing is unique to the mobile market, it's an area in which testing skills and accompanying tools are still evolving. There are a variety of interrupts that can occur while using an application. These interrupts, such as incoming calls and text messages, can happen at any time, and the user should not be expected to "pause" their application or save needed data. It will be up to the application to ensure the appropriate action happens when an interrupt occurs.
Some examples of interrupts include:
- Incoming and outgoing SMS and MMS
- Incoming and outgoing calls
- Battery removal
- Cable insertion and removal for data transfer
- Network connectivity enabled or disabled
- Device power cycle
- Incoming push notifications
- Low memory or battery notification
Primarily, interrupt testing should ensure that applications are able to cleanly suspend and resume without disrupting the intended functionality. Depending on the nature of the application and the platform, different things may happen. The action an application takes during an interruption needs to be decided as a requirement up-front so that proper validation can occur. For example, if your application has an audio component, will the audio temporarily be suspended when the interrupt occurs? If your application is in the midst of logging on when an interrupt occurs, will it crash? Will it continue with the login? Will it save the login data?
Each mobile platform has its own recommendations for interrupt handling. For example, stale resources need to be cleaned up on iPhone applications when low memory notifications are received. If the iPhone application is data-centric, the state of the application is required to handle any premature exit of the application and have the ability to initiate from the same point when the application resumes.
Mobile applications that are client-server based need to be able to gracefully deal with loss of connectivity and properly sync up once the network is again available.
Though you'll want to do some manual testing for usability, automated test tools can provide a great deal of help in simulating interruptions.
One automated mobile application tool that can help with interrupt testing, among other types of mobility testing, is mAutomate. MAutomate is a record and playback tool for mobile application testing. Testers are able to record a clean functional test, without the interrupts, to be executed on target devices. Then, using the tool's wizard, the tester can insert interrupts at any stage in the test script without writing a single line of code. The tool is able to simulate the specified various interrupts on the device under test and then send the screenshot results back to the tool's Web interface.
There are other automation test tools available for mobility and interrupt testing depending on the device's operating system. For Android apps, a command-line tool called The Monkey is available through their SDK. Though the tool is advertised as a way to stress test mobile applications, it's also useful as an interrupt test tool.
"Monkey testing" is a term used to indicate testing in a random fashion, or generating random keystrokes or events -- such as a monkey might do -- to see how the system under test reacts. Using The Monkey mobile test tool, the tester is able to send a pseudo-random stream of user events to an emulator or device and then validate for appropriate behavior or report on errors or unhandled exceptions.
For iOS apps, there's a similar open source tool available via GitHub, UI AutoMonkey.
UI AutoMonkey is able to generate multiple commands that can be used, again, for both stress testing and interrupt testing. A template is configured that tells the tools which commands should be executed during the test session. After execution, the tool will generate an overview of problems or potential issues.
Automation tests such as these can be set up to be run automatically with every commit as part of a continuous integration system. This ensures that no code will be deployed without passing all automated regression tests.
With the large number of unpredictable events that can happen on mobile devices, interrupt testing is crucial, but can be a challenge. However, thanks to readily available automation tools, the tester is able to simulate interrupts and catch issues quickly. Some amount of manual exploratory testing for usability will still be necessary, but thanks to automation test tools, the majority of the tedious testing can be accomplished quickly and repeatedly, helping the team build and deploy a high-quality mobile application.
Here's why testers cannot afford to get complacent
The ABCs of mobile testing
Do you have the guts to be a software tester?