MonKey App stress test (primary articles)

This tutorial is for developers to stress testing, stress testing prior to check to see if your computer is configured android sdk environment variable, because of the need adb command to process test during MonKey

All tests were operating in the dos window (windows)

1. Detect whether the phone and computer links, command adb devices

Shown a mobile phone connection. It may be the next step.

 

2. By executing the CMD window: the adb the shell command parameters Monkey {+} be tested Monkey

3. To get help Monkey simple command comes, execute commands in CMD:

 

adb shell monkey –help

We can be more easily tested by this code.

Monkey command parameters introduced

1) Parameters: -p

The parameter -p constraints for specifying this parameter with one or more packets (the Package, i.e. App). Designation

After the package, Monkey will only allow the system to start the specified APP. If no packet, Monkey will allow the system to start APP all devices.

* Specify a package: the adb the shell 100 Monkey -p com.htc.Weather

Description: com.htc.Weather for the package name, the event count is 100 (ie 100 times simulation program so that Monkey random user events).

* Specify multiple packages: the adb the shell com.htc.Weather Monkey -p -p -p com.htc.photo.widgets 100 com.htc.pdfreader

* Not specified package: adb shell Monkey 100

 Description: Monkey random start APP and send one hundred random events.

* To see all of the equipment package, execute the following command in the CMD window:

 >adb shell

  #cddata/data

  #ls

2) Parameters: -v

Feedback information for designating the level (level of detail is the level information of the log), a total of three sub-levels, respectively corresponding to the parameters as follows:

Log level Level0 

Example adb shellmonkey -p com.htc.Weather -v 100

Description Default value, only a small amount of information on the boot prompt, complete and final test results, etc.

 

Log Level Level 1

Example adb shellmonkey -p com.htc.Weather -v -v 100

Description Provides more detailed logs, including event information is sent to each of Activity

 

Log Level Level 2

Example adb shellmonkey -p com.htc.Weather -v -v -v 100

The most detailed description of the log, including the test checked / unchecked Activity Information

 

3) parameters: -s

Specifies the pseudo-random number generator seed value, the sequence of events if the same seed, the two test Monkey also produced the same.

* Example:

 Monkey测试1:adb shell monkey -p com.htc.Weather –s 10 100

  Monkey 测试2:adb shell monkey -p com.htc.Weather–s 10 100

   Two tests the effect is the same as the operation sequence of simulated users (a series of operations consisting in certain sequence, i.e. a sequence of each operation) is the same. Operating sequence

Although column is randomly generated, but if we specify the same Seed value, to ensure that the random sequence of operations can generate two tests are identical, so the operation of the pseudo-random sequence

 

Machine;

 

4) Parameters: --throttle <msec>

Specifying a delay between user operation (i.e. incident), in milliseconds;

* Example: the adb the shell 100 3000 Monkey -p com.htc.Weather -throttle

  5) parameters:  --ignore-crashes from

It is used to specify when (Force & Close error) application crashes, Monkey whether to stop the run. If you use this parameter, even if the application crashes, Monkey will still send events, straight

 

The event count is complete.

* Example. 1: the adb shellmonkey -p-crashes from 1000 com.htc.Weather --ignore

  Weather during the test even if the program crashes, Monkey will still continue to send events until the number of events of 1000 so far;

* Example 2: adb shellmonkey -p com.htc.Weather 1000

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

6) Parameters:  --ignore-Timeouts

When an application is used to specify the occurrence of ANR (Application No Responding) errors, Monkey whether to stop the run. If you use this parameter, even if the application error occurred ANR,

 

Monkey will still send events until the event count is completed.

 

7) 参数:  --ignore-security-exceptions

When used to specify (such as a certificate license, network license, etc.) permit application error occurs, Monkey whether to stop the run. If you use this parameter, even if the application error occurred license,

Monkey will still send events until the event count is completed.

 

8) 参数:  --kill-process-after-error

It is used to specify when an application error occurs, whether to stop its operation. If specified, when an application error occurs, the application stops running and remain in the current state (note:

 

Applications are still only at the time the error occurred, the system does not end the process of the application).

 9) Parameters: --monitor-native-crashes

The collapse of the native code is used to specify whether the monitoring and reporting application occurs.

 

10) Parameters: --pct - {+} {+ Event Type Event Category Percentage}

It is used to specify the percentage number of events in each category (the Monkey sequence of events, the number of such incidents percentage of total number of events)

 

parameter:

Instructions for use:

Example:

 

- -PCT-Touch percentage} + {

Adjust the percentage of the touch event ( the touch event is a down-up event , which occurs at a single location on the screen)

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

 

Percentage --pct-motion {+}

The percentage adjustment operation event ( an operation event of a screen somewhere down event , a series of events and a pseudo random events that up) the adb Monkey -p com.htc.Weather the shell 20 is Motion-1000-PCT

 

- -PCT-Trackball percentage} + {

Adjust the percentage of track events ( track events by one or more random movement composition, sometimes accompanied by clicks )

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

--pct-nav {+} percentage (not in real time the child)

Adjusting the percentage of the "basic" navigation event (navigation event from an input device by the direction up / down / left / right composition)

adb shell monkey -p com.htc.Weather--pct-nav 40 1000

 

Percentage --pct-majornav {+}

Adjusting the percentage of "primary" navigation event (typically initiates the operation of these navigation event graphical interface, such as: 5-way keypad center button, rewind button, a menu button )

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

 Percentage --pct-syskeys {+}

The percentage adjustment "system" key event (these buttons are typically 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

 

Percentage --pct-appswitch {+}

Activity percentage of adjusted start. At random intervals in, Monkey will perform a startActivity () call , a method for all packages as the maximum degree of coverage Activity

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

Percentage --pct-anyevent {+}

The percentage adjustment other type of event. It include all other types of events, such as: buttons, other less frequently used device buttons, etc.

adb shell monkey -p com.htc.Weather

 

--pct -anyevent 100 1000 * specified percentage of multiple types of events:

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

Note: Total percentage of each type of event can not exceed 100%;

 

 

 

 

 

 

Note that this test example adb shell monkey -p com.jysd.quanquanbanking -s 10 1000

adb shell monkey -p com.jysd.quanquanbanking --ignore-crashes --ignore-timeouts -s 10 1000

adb shell monkey -p com.jysd.quanquanbanking --ignore-crashes --ignore-timeouts -s 10 --pct-touch 10 --pct-motion 20 --pct-trackball 20 --pct-syskeys 20 --pct-appswitch 30 1000

Complete Test Description Test package name com.jysd.quanquanbanking, if the system crashes continue to test out, if there is not also continue to test the response, specify a -s represent every executed in accordance with this, if you do not perform the same every time cancel -s 10 specifies the touch event accounted for 10% of the number of executions, click on the event, 20%, and also track events with click events accounted for 20% of system keys (Home, Back, Start Call, End the expression Call and volume control keys) accounted for 20%, accounting for 30% of the page jump test.

 

 

 

The total percentage is 100%

 

 

 

Want to learn more programming information, please pay attention to micro-channel public number: IT010101

 

 

Published 24 original articles · won praise 16 · views 40000 +

Guess you like

Origin blog.csdn.net/ccc920123/article/details/52994056
Recommended