One, Monkey command format
[adb shell] monkey [optiongs] <eventcount>
ADB Shell Monkey-help>>d:help.txt
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
Note: Monkey can make multiple packages at the same time, but one-p only can specify one package, and all packages are placed under Data/data
Second, the monkey command detailed
Category |
Option |
Description |
Conventional |
--help |
Print a simple usage |
-V |
Level 0: Start prompt + Test complete + final result Level1: Events sent to Activity individually Level2: Activity thatis selected or unchecked in the test |
Events |
-S <seed> |
Use the same seed value that generates the sequence of events you want to use to help troubleshoot the problem ( Bug ) |
--throttle millisec |
The general event is set to 300-500 milliseconds (do last) |
--pct-touch <percent> |
Touch Events (down-up) |
--pct-motion <percent> |
Action Events (down-**-up) |
--pct-trackball <percent> |
Trackball Events (System move and click) |
--pct-nav <percent> |
Basic navigation events up or down |
--pct-majornav <percent> |
Main navigation events (middle key, fallback button, menu key) |
--pct-syskeys <percent> |
System time home,back,start/end call Volume Control key) |
--pct-appswitch <percent> |
Activity Start Event |
--pct-flip |
Keyboard Rollover Events |
--pct-pinchzoom |
Scaling Events |
--pct-anyevent <percent> |
Other events (infrequently used keys) |
Constraints |
-P <allowed-package-name> |
Multiple packages can be made at the same time, but one- p can only specify one package, and all packages are placed under data/data |
-c <main-category> |
-c activity c:\users\administrator>adb Shell monkey-p com.luyankeji.beixun-c android.intent.category.launcher --throttle 1000 Span class= "font10" >:includecategory:android.intent.category.launcher : includecategory: Android.intent.category.MONKEY |
Debugging |
--dbg-no-events |
Execute open Initial program, no further action --setup scriptfile-f ScriptFile [-f ScriptFile] ... : adb shell monkey-v-f/sdcard/monkey.script Execution Monkey Script Content |
--hprof |
Profiling files are generated before and after the monkey event and are located in/data/misc/(//Generated profiling reports In/data/mis) |
--ignore-crashes |
Ignoring program crashes or exceptions, Monkey continues to send events to the system |
--ignore-timeouts |
Ignore ANR (Application not response) |
--ignore-security-exceptions |
Ignore certificates or authentication exceptions. After setting this option |
--kill-process-after-error |
Notifies the system that the process of stopping the error has occurred |
--monitor-native-crashes |
Monitor and report local code crash events in Android systems |
--ignore-native-crashes |
Ignore Android Local code crash events in the system |
--wait-dbg |
Stop monkey in execution until the debugger is connected to it |
--pkg-blacklist-file Package_blacklist_file |
screening tests are included in the blacklist APK |
--pkg-whitelist-file Package_white_file |
Test only included in whitelist apk |
--port Port |
to be Monkey turn on the private port, then Monkey Will not be executed, can be manually operated, the operation feedback will be printed in cmd in the window c:\users\administrator>adb Shell Monkey--port 1113 Activityresuming (Com.tencent.news) |
Third, monkey log
Iv. ways to kill the monkey process
1. C:\USERS\ADMINISTRATOR>ADB Shell PS
2, find the monkey process PID number
3. C:\USERS\ADMINISTRATOR>ADB Shell Kill 9 PID
V. Examples
Monkey command line