ADB Shell Monkey Command
Monkey Commands
Adb shell monkey –p <package_name>
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
–throttle delay between each action.
-s (seed) which use to generate random actions, if two command with same seed value, the actions order will be same. It can be used to repro the issue with same actions. The output of two monkey commands will be same if set seed value as same.
–pct-touch percent of touching. Click event.
–pct-motion action event.
–pct-trackball.
–pct-nav basic navigation, using up, down, left and right in the input device.
–pct-majornav back, menu, and OK(middle) key and soft navigation keys.
–pct-syskeys System navigation: HOME, BACK, Volume, Phone Call key, hard keys.
–pct–appswitch Start activity event. Switch activity in the app.
–pct-anyevent any event.
–ignore-crashes ignore crashes and exception. CRASH in monkey log.
–ignore-timeouts ignore ANR and continue actions. ANR log filter in monkey log is “ANR in “. CPU, memory, exception information will be displayed in the following log.
Monkey will stop when meet crash and ANR.
Repeatable scenarios (serial actions):
Adb shell monkey –f
-v list all actions has been executed.
// Event percentages:
// 0: 20.0% –pct-touch
Percent of touch, different types of click event.
ACTION_UP, ACTION_DOWN, ACTION_MOVE (Trackball), Rotation.
// 1: 20.0% –pct-motion
Action event.
// 2: 0.0%
// 3: 0.0%
// 4: -0.0%
// 5: 30.0%
// 6: 30.0%
// 7: 0.0%
// 8: 0.0%
// 9: 0.0%
// 10: 0.0%