While monkey testing my app
% adb shell monkey -p com.foo.bar --throttle 1000 -v 14400
I notice that it accesses various system settings on my device like audio control and taking screen shots. According to http://developer.android.com/tools/help/monkey.html, this is the way it was meant to behave.
The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events.
Is it possible to exclude the system level events so the monkey completely focuses on my target app?
I looked at the '-c' option for constraints, but looking at the available Intents at http://developer.android.com/reference/android/content/Intent.html, I don't seem to see anything related to disabling such system level events.
Any pointers?
By setting the
-pct-sysevents
to zero.However, while using the monkey command, there is a small catch, which is regarding the order of events.
-v
is a verbosity flag.COUNT must appear at the very end in the command
The command usage is given below.
All options are explained: https://developer.android.com/studio/test/monkey.html
I've managed to change the "system" events ratio by setting the
--pct-syskeys
a much higher value.In my case, the monkey keep showing the notification area and changing wifi settings (my app is wifi-only) and this parameter solved the problem.