Interruption Testing with ADB - Notes By ShariqSP
Interruption Testing with ADB
Interruption testing ensures that an application behaves as expected when subjected to various real-world interruptions. These interruptions could include network changes, incoming calls, battery level changes, or device connections. This section provides examples of interruption testing for the Candy Crush APK using ADB commands.
Example: Testing Candy Crush APK
Download the Candy Crush APK from shariqsp.com/apk/candycrush.apk and install it on your device using the steps outlined earlier. Below are various interruption testing scenarios for this app.
1. Network Interruption Testing
Test how the app behaves when network connectivity is interrupted or fluctuates.
-
Simulate Turning Off Wi-Fi:
adb shell svc wifi disable
-
Simulate Turning On Wi-Fi:
adb shell svc wifi enable
-
Simulate Mobile Data Off:
adb shell svc data disable
-
Simulate Mobile Data On:
adb shell svc data enable
-
Switch Network Modes: Simulate switching between network types (e.g., 3G to 4G):
adb shell settings put global preferred_network_mode 9
2. Functionality-Dependent Interruption Testing
Test how the app handles interruptions caused by phone functionalities like calls or text messages.
-
Simulate an Incoming Call:
adb shell am start -a android.intent.action.CALL -d tel:+1234567890
-
Simulate Ending a Call:
adb shell input keyevent KEYCODE_ENDCALL
-
Send an SMS:
adb shell service call isms 5 s16 "1234567890" i32 0 i32 0 s16 "Test Message"
-
Simulate Alarm Trigger:
adb shell am broadcast -a android.intent.action.ALARM_CHANGED --ez alarmSet true
-
Simulate Calendar Event: Trigger a calendar notification.
adb shell am broadcast -a android.intent.action.EVENT_REMINDER
3. Device-Dependent Interruption Testing
Test interruptions that depend on device states, such as battery level changes and USB connections.
-
Simulate Low Battery (1%):
adb shell dumpsys battery set level 1
-
Simulate Full Battery (100%):
adb shell dumpsys battery set level 100
-
Simulate Charging State:
adb shell dumpsys battery set status 2
-
Simulate USB Connection:
adb shell setprop sys.usb.config mtp
-
Simulate USB Disconnection:
adb shell setprop sys.usb.config none
4. Additional Interruption Testing Examples
These additional scenarios can help assess app robustness:
-
Change Screen Orientation:
adb shell settings put system user_rotation 1
-
Lock and Unlock the Device:
adb shell input keyevent 26
-
Simulate Do Not Disturb Mode:
adb shell settings put global zen_mode 1
-
Simulate Screen Timeout:
adb shell settings put system screen_off_timeout 1000
-
Simulate Airplane Mode:
adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE