Disabling system events on an Android monkey

While the monkey is testing my application

% adb shell monkey -p com.foo.bar --throttle 1000 -v 14400 

I notice that he is referring to various system settings of my device, for example, to audio monitoring and taking screenshots. According to http://developer.android.com/tools/help/monkey.html , this is the way he was supposed to behave.

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 series of events.

Is it possible to exclude events at the system level so that the monkey completely focuses on my target application?

I looked at the "-c" option for restrictions, but looking at the available intentions at http://developer.android.com/reference/android/content/Intent.html , I don't seem to see anything related to disabling such events system level.

Any pointers?

+9
android testing adb monkey
source share
2 answers

By setting -pct-sysevents to zero. However, the catch here is the order of events.

-v is the flag of verbosity.

COUNT should appear at the very end of the command

 adb shell monkey -p your.package.name -v --pct-syskeys 0 9999 adb shell monkey -p your.package.name -v --pct-syskeys 0 COUNT 

Use of the command is given below.

 usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...] [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...] [--ignore-crashes] [--ignore-timeouts] [--ignore-security-exceptions] [--monitor-native-crashes] [--ignore-native-crashes] [--kill-process-after-error] [--hprof] [--pct-touch PERCENT] [--pct-motion PERCENT] [--pct-trackball PERCENT] [--pct-syskeys PERCENT] [--pct-nav PERCENT] [--pct-majornav PERCENT] [--pct-appswitch PERCENT] [--pct-flip PERCENT] [--pct-anyevent PERCENT] [--pct-pinchzoom PERCENT] [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE] [--pkg-whitelist-file PACKAGE_WHITELIST_FILE] [--wait-dbg] [--dbg-no-events] [--setup scriptfile] [-f scriptfile [-f scriptfile] ...] [--port port] [-s SEED] [-v [-v] ...] [--throttle MILLISEC] [--randomize-throttle] [--profile-wait MILLISEC] [--device-sleep-time MILLISEC] [--randomize-script] [--script-log] [--bugreport] [--periodic-bugreport] COUNT 

All options are explained: https://developer.android.com/studio/test/monkey.html

+9
source share

I managed to change the event rate on the system by setting --pct-syskeys much higher value.

In my case, the monkey continues to show the notification area and changes the wifi settings (my application is only for Wi-Fi), and this parameter solved the problem.

0
source share

All Articles