sdet_liang
sdet_liang

Reputation: 41

How to prevent from Android monkey to turn off WIFI?

Sometimes, WIFI is turned off with following command to run monkey test on Android. Is there any method to prevent the Android monkey to turn off WIFI?

adb -s foo shell monkey -p com.foo.bar --throttle 300 --kill-process-after-error --pct-syskeys 0 --pct-trackball 0 --pct-touch 90 --pct-motion 10 -v 5000

Upvotes: 4

Views: 1442

Answers (1)

Vikasdeep Singh
Vikasdeep Singh

Reputation: 21766

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:

  1. Go to Settings > Security and Location > Turn on Screen Pinning
  2. Launch your app and click on Overview button (right most button next to Home button) and pin your app
  3. 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.

Upvotes: 1

Related Questions