The How and Why of Interrupt Tests for Mobile Apps

The How and Why of Interrupt Tests for Mobile Apps
Sarah Mischinger
  February 27, 2020

Have you ever wondered what happens to your app if the user’s device shuts down unexpectedly? What happens when a user receives a call or a push notification while using your app? The only way to find answers to these questions is to run interrupt tests for your mobile apps. Let’s learn more about this type of test and see how you can use it to provide your users with a consistent and enjoyable experience.

What Is Interrupt Testing?

Imagine you are using an app on your smartphone when you receive a call from a friend (which interrupts the app). After the phone call, you return to the app, which resumes operation and is still in the state you left it in. Naturally, as users, we don’t think much about this behavior because we’re already used to it. However, as a mobile app developer or tester, you can’t take things for granted and have to ensure that your app can resume its operations regardless of the interruption.

Simply put, interrupt tests allow you to check your app’s behavior after certain events that disrupt its flow. In many cases, Android and iOS take care of things for you, which is a reason why teams often forget to conduct this type of testing. However, in order to offer your users a positive experience, you need to make sure that your app always behaves as expected. Since these expectations don’t necessarily have to be the same for every mobile app and function, you have to define and test them yourself.

As you can see, performing interrupt tests on mobile apps is necessary to improve their quality and user experience. For this reason, you should integrate this test type into your test strategy for mobile apps, as we discussed in more detail in our blog post on the 9 most common test types.

Common Scenarios to Test

Before we talk about how to perform interrupt tests, let’s first check out some of the most common test scenarios to get you started:

  • Get an alert on low phone battery
  • Receive a call or text message
  • Get a push notification, e.g., from another app
  • Receive notifications when the device is connected to or disconnected from the power supply
  • Encounter different network connection states, e.g., internet connection loss and restoration
  • Get interrupted by the smartphone’s alarm clock, stopwatch or timer

You probably already have some ideas on how your app should behave after encountering the above interruptions. Of course, your app mustn’t crash – we can certainly agree on that. But let’s discover a few more options!

How Should Your Mobile App Handle Interruptions?

You are welcome to use the above interrupt test scenarios for your own test strategy and add more situations to complete this list for your mobile applications. However, we still need to define the app’s expected behavior for each scenario!

Fortunately, you don’t need to spend too much time thinking about and defining your mobile app’s expected behavior. Typically, users expect mobile apps to behave in a certain way because they’re just used to specific standards. As already mentioned, mobile operating systems already take care of some interruptions for you. For example, if a user receives a push notification from another app and does not tap on it, your app can simply resume its operations as if nothing had ever happened.

However, when the user taps on the notification received, their phone opens the corresponding app. As a result, your app will run in the background. You now have to check and make sure that the app behaves as desired when the user switches back to your app. The same applies to other interrupts, such as receiving a call, a text message, or any other event that makes your app run in the background.

Also, you’ll want to make sure everything is working correctly when the phone’s battery is low. If the phone shuts down unexpectedly, for example, due to an empty battery, check whether your app works as intended after a restart.

In summary, the key aspects to check are:

  • Does your app crash?
  • Can your app continue to operate as expected?
  • Can your app successfully “ignore” minor interruptions?

How to Perform Interrupt Tests for Mobile Apps Efficiently

In theory, you could perform interrupt tests for your mobile app manually. However, as you probably already know, manual testing can lead to severe bottlenecks that hinder the timely release of your app. Interrupt tests are no exception, and you should automate as many test scenarios as possible. For this, however, you need the right tools and frameworks!

The good news is that you can use almost any functional testing framework for interrupt testing. So, for example, if you use XCTest to conduct tests for iOS apps, you can add UI Interruption Monitors to your test cases, which you can learn more about from the Apple documentation.

Android offers you a handy command-line tool called UI/Application Exerciser Monkey that already comes built into the Android SDK. With this tool, you can generate pseudo-random event streams on your emulators or real devices. If you are looking for a tool that you can use to perform stress tests, Android’s Monkey tool is also a good choice!

Run your interrupt tests on multiple devices at once

Regardless of which tool or framework you use to automate your interrupt tests, you can still work on improving test execution times and, thus, the efficiency of your mobile app tests. Let’s say you run tests on one device and one OS version at a time. As a result, testing takes a really long time. The solution to this problem is to run tests on multiple devices concurrently – either in your in-house device lab or in a cloud-based solution.

Of course, parallel testing is not limited to interrupt tests, and you can save even more time by running all of your automated tests concurrently. In this way, you can ensure that your application works for the majority of your users, regardless of their device or operating system version.

We have written a few detailed articles on parallel testing to help you evaluate this technology’s benefits for your mobile apps:

Conclusion

Even if you have neglected interrupt testing in the past, we hope you are now eager to integrate it into your testing strategy. First, define possible interruptions and the expected behavior of your app. Then, create test cases with your preferred tool, automate them, and run them in parallel on as many devices as possible.

Why don’t you try our real device cloud for free and see how running your tests in parallel can significantly speed up testing your mobile apps?

Image by Ivana Divišová via [source link] (copyright-free)

You Might Also Like