Parameters of the Monkey test

Source: Internet
Author: User

First,Monkey test Introduction

Monkey testing is an automated test of the Android platform, through the Monkey program to simulate the user touch screen, sliding trackball, keys and other operations to the device's program on the pressure

Force test, the duration of the procedure will be abnormal.

Ii.Introduction of Monkey procedure

1) The Monkey program is provided by the Android system , written in the Java language, in the Android file system, the storage path is:/system/ Framework/monkey.jar;

2) The Monkey.jar program is initiated by a shell script called "Monkey" ,where the shell script is stored in the Android file system in the following path: /system/bin/monkey;

This allows the monkey to be tested by executing in the CMD window : adb shell monkey {+ command Arguments} .  

Iii. Simple Help for the Monkey command

To get The simple help that comes with the Monkey command , execute the command in CMD:

ADB Shell Monkey–help

Iv.Introduction of Monkey command parameters

1) parameter:- p

The parameter- p is used for constraint restrictions, and this parameter specifies one or more packages (the package, or App). Specify

After the package,Monkey will only allow the system to launch the specified APP. If you do not specify a package,Monkey will allow the system to boot all apps in the device .

* Specify a package: adb shell monkey-p com.htc.Weather

Description:Com.htc.Weather is the package name, whichis the event count (that is, let the Monkey program simulate a random user event).

* Specify multiple packages:adb shell monkey-p com.htc.weather–p com.htc.pdfreader-p com.htc.photo.widgets

* do not specify package:adb shell Monkey

Description:Monkey randomly launches the APP and sends a random event.

* to view all the packages in the device, execute the following command in the CMD window:

>ADB Shell

#cd Data/data

#ls

2) parameter :-V

Used to specify the level of feedback information (the level of information is the verbosity of the log), with a total of 3 levels, respectively, with the corresponding parameters as shown in the following table:

Log levels level 0

Sample adb shell monkey-p com.htc.weather–v

Describe default values, providing only small amounts of information such as startup hints, test completion, and final results

Log levels level 1

Sample adb shell monkey-p com.htc.weather–v-v

Description provides a more detailed log, including each event message sent to the Activity

Log levels Level 2

Sample adb shell monkey-p com.htc.weather–v-v–v

Description of the most detailed log, including the selected /unchecked Activity information in the test

3) parameter:- s

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 shell monkey-p com.htc.weather–s

Monkey Test 2:adb shell monkey-p com.htc.weather–s

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. Operation Sequence

The columns are 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 -

the machine;

4) Parameters: --throttle < ms >

Used to specify the delay between user actions (that is, events), in milliseconds;

* Example:adb shell monkey-p com.htc.weather–throttle

5) parameter: --ignore-crashes

Lets you specify whether Monkey stops running when the application crashes (Force & Close Error) . If you use this parameter, even if the application crashes,Monkey will still send the event, straight

To the event count is complete.

* Example 1:adb shell monkey-p com.htc.Weather--ignore-crashes

even if the Weather program crashes during the test ,Monkey will continue to send events until the number of events reaches $ ;

* Example 2:adb shell monkey-p com.htc.Weather

During the test, if the Weather program crashes,Monkey will stop running.

6) parameter: --ignore-timeouts

Used to specify Whether Monkey stops running when an application has a ANR (application No responding) error . If you use this parameter, even if the application has a ANR error,

Monkey still sends events until the event count is complete.

7) parameter: --ignore-security-exceptions

Used to specifywhether Monkey stops running when an application has a licensing error (such as certificate licensing, network licensing, and so on) . If you use this parameter, even if the application has a licensing error,

Monkey still sends events until the event count is complete.

8) parameter: --kill-process-after-error

Lets you specify whether to stop the application from running when an error occurs. If this parameter is specified, the application stops running and remains in the current state when an application error occurs (Note:

The application is static only when the error occurs, and the system does not end the process of the application.

9) parameter: --monitor-native-crashes

Used to specify whether to monitor and report local code for application crashes.

parameters: --pct-{+ event category} {+ event category%}

Used to specify the percentage of events per category (in the Monkey event sequence, the number of such events as a percentage of the total number of events)

Parameters :

Instructions for use :

Example :

--pct-touch {+ percent}

Adjust the percentage of touch events ( Touch event is a down-up event that occurs in a single location on the screen )

adb shell monkey-p com.htc.Weather--pct-touch 10 1000

--pct-motion {+ percent}

Adjust 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 ) adb shell monkey-p

Com.htc.Weather--pct-motion 20 1000

--pct-trackball {+ percent}

Adjusts the percentage of track events ( track events consist of one or several random movements, sometimes accompanied by clicks )

adb shell monkey-p com.htc.Weather--pct-trackball 30 1000

--pct-nav {+ percent}

Adjust the percentage of basic navigation events ( navigation events consist of up/down/left/right from the direction input device )

adb shell monkey-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 )

adb shell monkey-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 )

adb shell monkey-p com.htc.Weather--pct-syskeys 60 1000

--pct-appswitch {+ percent}

Adjusts The percentage of startup Activity. In a random interval,Monkey will execute a startactivity () call as a way to maximally cover all Activity in the package

adb shell monkey-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.

ADB Shell Monkey-p Com.htc.Weather

--pct-anyevent 1000* Specifies the percentage of multiple types of events:

adb shell monkey-p com.htc.Weather--pct-anyevent--pct-appswitch 50 1000

Note: The total percentage of each event type cannot exceed 100%;

Here is a test command I applied to the project:

adb shell monkey-p com.***.***--pct-touch--pct-motion 0--pct-trackball 0--pct-nav--pct-majornav Switch ten--pct-syskeys 5--pct-anyevent 5-s 19761202--

Ignore-crashes--ignore-timeouts-v--throttle 20000>d:\monkeytest.txt

Transfer from http://i.cnblogs.com/EditPosts.aspx?postid=4201122&update=1

Parameters of the Monkey test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.