Skip to content

lana-20/interruption-interference-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 

Repository files navigation

Why Interruption/Interference Configuration is Important in Testing the Mobile App Activities

📝 This post is mostly about Android.

Why Conduct Interrupt Testing?

Interruption Testing is a type of testing that involves simulating various types of interruptions or distractions that a user may experience while using a mobile app. Some common types of interruptions that may be tested include:

  • Incoming Phone Calls: If an app is being used and an incoming phone call is received, it’s important to test how the app handles the interruption. Does it pause or stop functioning? Does it allow the user to continue using the app while the call is being taken?

    • For example, simulate a call on an emulator with adb:

      adb shell am start -a android.intent.action.CALL
      
    • Or, simulate a call on an emulator with Extended Controls:

  • Incoming Text Messages: Similar to phone calls, incoming texts can interrupt an app and cause it to pause or close. This type of interruption tests how the app handles an incoming text message while it’s being used and ensures it resumes correctly after the interruption ends.

    • For example, simulate an SMS on an emulator with adb:
  • Notifications or Alarms: Mobile apps often generate (push) notifications to alert the user of new events or updates. It’s important to test how the app handles notifications and whether the user is able to continue using the app while the notification is being displayed.

  • System Alerts: The OS may generate alerts or notifications that interrupt the app. It’s important to test how the app handles these interruptions and whether it allows the user to continue using the app while the alert is being displayed.

  • System Updates: If the device’s OS is updated while the app is being used, it can interrupt the app and cause it to close. It’s important to test how the app handles these interruptions and ensure that it can resume correctly after the update is complete.

  • Low Battery or Power Loss: If the device’s battery is running low or the device loses power, it can interrupt the app and cause it to close. It’s important to test how the app handles the interruption and whether it allows the user to continue and save all the important data while the device is being charged.

  • Multitasking / App Switching / Multi-Window: Many mobile devices allow users to multitask and switch between multiple apps. It’s important to test how the app handles multitasking an whether it allows the user to continue using the app while other apps are being used. App switching tests how the app handles being switched out of the foreground and into the background.

  • Device Rotation: This type of interruption tests how the app handles the device being rotated from portrait to landscape and vice versa.

  • Network Changes: If the device’s network connection changes while the app is being used (e.g. from WiFi to cellular data), it can interrupt the app and cause it to behave differently. It’s important to test how the zoo handles these interruptions and ensure that it functions properly under different network conditions. It’s crucial to test these types of interruptions that may occur while the app is being used to ensure the app provides smooth, seamless, uninterrupted, stable and consistent user experience.


Test the following common scenarios for mobile app testing:

A poorly implemented Android Lifecycle can lead to the following results:

  • Crashing if the user receives a phone call or switches to another app while using your app.
  • Consuming valuable system resources when the user is not actively using it.
  • Losing the user's progress if they leave your app and return to it at a later time.
  • Crashing or losing the user's progress when the screen rotates between landscape and portrait orientation.

Activities serve as containers for every user interaction within your app, so it's important to test how your app's activities behave during device-level events, such as the following:

  • Another app, such as the device's phone app, interrupts your app's activity.
  • The system destroys and recreates your activity.
  • The user places your activity in a new windowing environment, such as picture-in-picture (PIP) or multi-window.

In particular, it's important to ensure that your activity behaves correctly in response to the events described in Understanding the Activity Lifecycle.

Different events, some user-triggered and some system-triggered, can cause an Activity to transition from one state to another. The Activity State Changes document describes some common cases in which such transitions happen, and how to handle those transitions.


Stress and Interrupt Testing

Stress and interrupt testing is an important part of the mobile testing process. With the aid of tools, mobile testers are able to determine any potential performance or stability issues exhibited by an app. To test your app against interrupts, you can manually trigger lots of notifications to the device while using the app. Notifications can be incoming messages, calls, app updates, or push notifications (software interrupts). Furthermore, pressing the volume up and down buttons or any other kind of hardware button is also an interrupt (hardware interrupt) that can also have an impact on your app.

Doing all of these tasks manually is a lot of work and very time-consuming. In most cases, these test scenarios can’t be done manually because it is very hard to simulate fast and multiple user inputs with one or two hands. But it can be done with the aid of tools, and it is really easy to integrate them into the development and testing process.

For Android apps, a tool called Monkey can be used which is part of the Android SDK (Software Development Kit). Monkey can run on either a physical device or an emulator. While running, it generates pseudo-random user events such as a touch, click, rotate, swipe, mute, Internet connection shutdown, and much more to stress-test the app and see how it handles all those inputs and interrupts.

The package name of the Android .apk file is needed to be able to run Monkey; otherwise it will execute its random commands to the entire phone. When the package name (in this case com.appiumpro.the_app) is available, execute Monkey with adb (Android Debug Bridge):

adb shell monkey -p com.appiumpro.the_app -v 2000

The number 2000 indicates the number of random commands that Monkey will perform. With an additional parameter -s for seed, Monkey will generate the same sequence of events again. This is really important for reproducing a bug that may occur when running Monkey.

The Monkey tool makes it simple to stress- and interrupt-test a mobile application. Besides that, using them is a huge benefit for mobile testers as it helps the team build a reliable and robust mobile app. It’s useful to combine battery testing with stress and interrupt testing to see how the battery is used when lots of interrupts and user inputs are triggered throughout the app.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published