Android App Stress test (i)---monkey introduction and basic use

Source: Internet
Author: User

Objective:

a long time ago, I heard of monkey, but what is monkey to do, how to use it, we still have the simplest problem to start learning it;

PS: my blog post format has changed, read a lot of blog post, found that this style reading is very organized, I also refer to the following: Hehe--

Directory

A: Monkey introduction

II: Characteristics of Monkey

Three: Monkey's command parameter description

Four: Monkey Use example

A: Monkey introduction

said: Monkey is a naughty monkey, in the app in the random press, disorderly touch, disorderly jump;

Simulate the user touch screen, sliding trackball, keys and other operations, the simulator or mobile phone software for stress testing ;

Detection the stability and robustness of software ;

Principle: Send pseudo-random user event Stream (key input, touch input, gesture input) to the system, stress test software;

II: Characteristics of Monkey

(1) The test object is only the application package (APK package,) has certain limitations;

(2) The Monkey test uses the event stream, the data flow is random, cannot make the customization;

(3) The Monkeytest object, the number of events, type, frequency, etc. can be set;

Although the monkey tool is imperfect, it is sufficient to meet the basic testing needs of the application, and if more powerful testing tools are needed, use the evolutionary version of Monkey Monkeyrunner;

Three: Monkey's command parameter description

Monkey includes many options, broadly divided into four categories

1: Basic Options

-help Printing Help Documents

-V: Specifies the level of detail for printing information, and a-V adds a level.

-v:level 0, default value, provides only a small amount of information such as startup hints, test completion, and final results

-v-v: Level 1, provides a more detailed log, including event information for each activity sent to

-v-v-v:level 2, the most detailed log, including the selected/unchecked activity information in the test

2: Event Options

-S: The seed value of the pseudo-random number generator. If you run monkey again with the same seed value, it will generate the same sequence of events;

--throttle < milliseconds;: Insert delay between events. This option slows down the execution of the monkey, and if you do not specify this option, the monkey will not be delayed and the event will be generated as soon as possible;

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

--pct-motion: 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)

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

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

--pct-majornav: Adjust the percentage of the primary navigation event (these navigation events usually trigger actions in the graphical interface, such as: 5-way keyboard, Fallback button, menu button)

--pct-syskeys: 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).

--pct-appswitch: Adjust the percentage of startup activity

--pct-anyevent: Adjust the percentage of other types of events

3: Constraint options

-P: Specify one or more packages (specify multiple packages, use multiple-p, each-p option can only be used for one package)

-C: Specify one or more categories ()

4: Debug Options

--ignore-crashes: Typically, when an application crashes or any exception occurs, monkey stops running. If this option is set, Monkey will continue to occur to the system until the count is complete

--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 occur to the system until the count is complete

--ingore-security-exceptions: Typically, when an application has a licensing error (such as initiating 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 went wrong 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 Android system. If--kill-process-after-error is set, the system will stop running. --wait-dbg: Stops execution of the monkey until a debugger is connected to it.

Four: Monkey usage example

(1) Specify a package: adb shell monkey-p Pack 1000

(2) Seed value: adb shell monkey-p package-s 10 1000

(3) Log level: adb shell monkey-p package-v-V 1000

The printed log is too long and can be redirected to a file;

The log files are as follows:

The address of this article to learn the blog:

Http://www.cnblogs.com/findyou/p/3940671.html#Mon03

http://blog.csdn.net/lfyx1357/article/details/7418133

Android App Stress test (i)---monkey introduction and basic use

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.