Monkey all options available on the command line
Conventional
--help
Lists the simple usage.
-V
Each-V of the command line increases the level of feedback information.
Level 0 (default) provides less information than startup prompts, test completion, and end results.
Level 1 provides more detailed testing information, such as events sent individually to the activity.
Level 2 provides more detailed setup information, such as the activity that was selected or unchecked in the test.
Log levels Level 0
* Example Adbshell monkey-p com.htc.weather–v 100
Describe default values, providing only small amounts of information such as startup hints, test completion, and final results
Log levels Level 1
* Example Adbshell monkey-p com.htc.weather–v-v 100
Description provides a more detailed log, including each event message sent to the activity
Log Levels Level 2
* Example Adbshell monkey-p com.htc.weather–v-v–v 100
Description of the most detailed log, including the selected/unchecked activity information in the test
Event
-S <seed>
Used to specify the seed value of the pseudo-random number generator, and if the seed is the same, the sequence of events produced by the two monkey tests is the same.
Example
Monkey Test 1:adb shellmonkey-p com.htc.weather–s 10 100
Monkey Test 2:adb shellmonkey-p com.htc.weather–s 10 100
The effect of the two Tests is the same, because the simulated sequence of user actions (a sequence of operations consisting of each operation in a certain order) is the same. The sequence of operations is randomly generated, but as long as we specify the same seed value, we can guarantee that the random sequence of operations generated by the two Tests is exactly the same, so this sequence of operations is pseudo-random;
--throttle<milliseconds>
Inserts a fixed delay between events. This option slows down the execution speed of the monkey. If this option is not specified, the monkey will not be delayed and the event will be produced as soon as possible.
* Example: adb shellmonkey-p com.htc.weather–throttle 3000 100
--pct-touch<percent>
Adjusts the percentage of touch events (a touch event is a down-up event that occurs in a single location on the screen).
* Example: adb shellmonkey-p com.htc.Weather--pct-touch 10 1000
--pct-motion<percent>
Adjusts the percentage of action events (an action event consists of a down event, a series of pseudo-random events, and an up event somewhere on the screen).
* Example: adb shellmonkey-p com.htc.Weather--pct-motion 20 1000
--pct-trackball<percent>
Adjusts the percentage of track events (the trajectory event consists of one or more random movements, sometimes accompanied by clicks).
* Example: adb shellmonkey-p com.htc.Weather--pct-trackball 30 1000
--pct-nav<percent>
Adjusts the percentage of the basic navigation event (the navigation event consists of the up/down/left/right from the direction input device).
* Example: adb shellmonkey-p com.htc.Weather--pct-nav 40 1000
--pct-majornav<percent>
Adjust the percentage of primary navigation events (these navigation events usually trigger actions in the graphical interface, such as: 5-way keyboard, Fallback button, menu button)
* Example: adb shellmonkey-p com.htc.Weather--pct-majornav 50 1000
--pct-syskeys<percent>
Adjusts the percentage of the System key event (these keys are usually reserved for use by the system, such as home, back, Start call, End call, and volume control keys).
* Example: adb shellmonkey-p com.htc.Weather--pct-syskeys 60 1000
--pct-appswitch<percent>
Adjusts the percentage of startup activity. In a random interval, monkey executes a startactivity () call as a way to maximally cover all activity in the package.
* Example: adb shellmonkey-p com.htc.Weather--pct-appswitch 70 1000
--pct-anyevent<percent>
Adjusts the percentage of other types of events. It includes all other types of events, such as keystrokes, other infrequently used device buttons, and so on. * Example: adb shell monkey-p com.htc.Weather
--pct-anyevent 1001000* Specifies the percentage of multiple types of events:
adb shell Monkey-pcom.htc.weather--pct-anyevent--pct-appswitch 50 1000
Note: The total percentage of each event type cannot exceed 100%;
Constraint restrictions
-p<allowed-package-name>
If you specify one or several packages with this parameter, monkey will only allow the system to start the activity in those packages. If your application also needs to access activity in other packages (such as choosing to take a contact), those packages need to be specified at the same time. If you do not specify any packages, monkey will allow the system to start the activity in all packages. To specify multiple packages, you need to use multiple-p options, and each-p option can be used for only one package.
* Specify a package: adb shell monkey-p com.htc.Weather 100
Description: Com.htc.Weather is the package name, 100 is the event count (i.e. let the monkey program simulate 100 random user events).
* Specify multiple packages: adb shell monkey-p com.htc.weather–pcom.htc.pdfreader-p com.htc.photo.widgets 100
* Do not specify package: adb shell Monkey 100
Description: Monkey randomly launches the app and sends 100 random events.
* To view all the packages in the device, execute the following command in the cmd window:
>ADB Shell
#cd Data/data
#ls
-c<main-category>
If you specify one or more categories with this parameter, monkey will only allow the system to start activity that is listed by a category in these categories. If you do not specify any categories, MONKEY will select the Activity:Intent.CATEGORY_LAUNCHER or Intent.category_monkey listed in the following categories. To specify multiple categories, you need to use multiple-c options, and each-c option can only be used for one category.
Debugging
--dbg-no-events
Set this option, monkey will perform the initial boot, enter into a test activity, and no further events will be generated. For best results, combine it with-V, one or several package constraints, and a non-0 value that keeps monkey running for 30 seconds or longer, providing an environment to monitor conversions between packages called by the application.
--hprof
Set this option to generate the profiling report immediately before and after the monkey event sequence. This will generate a large file (~5MB) in the Data/misc, so use it with care.
--ignore-crashes
Typically, monkey stops running when an application crashes or any runaway exception occurs. If this option is set, Monkey will continue to send events to the system until the count is complete.
* Example 1:adb shellmonkey-p com.htc.Weather--ignore-crashes 1000
Even if the weather program crashes during the test, Monkey continues to send events until the number of events reaches 1000;
* Example 2:ADB Shell monkey-p Com.htc.Weather 1000
During the test, if the weather program crashes, Monkey will stop running.
--ignore-timeouts
Typically, monkey stops running when an application has any time-out errors, such as the application not responding dialog box. If this option is set, Monkey will continue to send events to the system until the count is complete.
--ignore-security-exceptions
Typically, when an application has a licensing error (such as starting an activity that requires some permission), Monkey will stop running. If this option is set, Monkey will continue to send events to the system until the count is complete.
--kill-process-after-error
Typically, when Monkey is stopped due to an error, the application that is faulted will continue to be in the running state. When this option is set, the system will be notified of the process of stopping the error. Note that the normal (successful) end, and does not stop the process from starting, the device simply stays in the final state after the end event.
--monitor-native-crashes
Monitor and report crash events for native code in your Android system. If--kill-process-after-error is set, the system will stop running.
--wait-dbg
Stop monkey in execution until there is a debugger connected to it.
Monkey test all options available on the 4--monkey command line