To avoid system events in Monkey testing there is option --pct-syskeys
which is responsible for system level events but I think --pct-syskeys 0
is not working.
There is work around for this, Screen Pinning your app. By doing this only your app will be tested and will not turn off Wi-Fi and you can perform your testing. Follow below steps:
- Go to Settings > Security and Location > Turn on Screen Pinning
- Launch your app and click on
Overview button
(right most button next to Home button) and pin your app
- Now run your monkey command from terminal and test your app
Note: If your are testing on Emulator. Once you are done with testing, to unpin your app you must have to restart your Emulator. Restart emulator
is the only option to unpin your app on Emulator.
Above testing is done on Android 8 emulator.