On Sdk,monkey

Source: Internet
Author: User

Recently in the outside of work encountered some mobile phone test novice, now test the basic Android phone is the system.

And then you start to run into problems when you run into stress tests.

What tools are used for stress testing? How to use the tool?

Today I met two people who asked me if the SDK was to be installed ...

The fastest and easiest way to perform stress testing in Android phone testing is to use monkey, how does Mongkey work?

Many people now know to use the SDK

What is an SDK?

SDK: (software development Kit) software Development Kit. A collection of development tools used by software development engineers to build applications for specific software packages, software frameworks, hardware platforms, operating systems, and more.
Therefore, the Android SDK refers to the Android-specific software development kit.

In Android testing, we often simply say the SDK, here's the SDK we're going to assume is the Android SDK

The SDK is in the Java language, so use the SDK and have the JDK first.

Two. Download

To download the JDK and SDK. The best recommendation is to download from the official website to ensure the integrity of the file. One-time fix.

SDK (5.0.32bit):

http://pan.baidu.com/share/link?shareid=3534973012&uk=369127748

JDK (7):

http://pan.baidu.com/share/link?shareid=3552816141&uk=369127748

JDK is to be installed, the SDK is pressurized and placed in the defined directory, the configuration environment can be used

Three. Environment configuration

Specific reference

Http://hi.baidu.com/szy123618/item/48be8134cdfcd5c3382ffaa1

Here about the environment configuration said is more detailed. can be used as a reference

Four. Pre-use verification

Verified to verify that our environment is configured correctly or that the JDK is installed correctly

Verify JDK: On command line input: java-version

Show current Java version

To verify the SDK:

On the basis of the above. Then run monkey what the basic should be no problem.

Incidentally, the basics of monkey:

What is Monkey test:

Monkey is a command-line tool in Android that can be run in the emulator or in the actual device. It sends pseudo-random user event streams (such as key input, touch input, gesture input, etc.) to the system, enabling stress testing of the application under development. Monkey testing is a fast and effective method to test the stability and robustness of the software.

Characteristics of Monkey

1, the test object is only the application package, there are certain limitations.

2. The event stream data stream used by the Monky test is random and cannot be customized.

3, can set the Monkeytest object, the number of events, type, frequency, etc.

Basic commands and parameters for Monkey:

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

-S <seed>
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>
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.

--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).

--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).

--pct-trackball <percent>
Adjusts the percentage of track events (the trajectory event consists of one or more random movements, sometimes accompanied by clicks).

--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).

--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)

--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).

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

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

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

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

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

--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 instances:

adb shell monkey-p com.android.browser--pct-touch--pct-motion--pct-trackball 10-s 3000-v--throttle 1000 500 0 > D:\monkey_log.txt

Monkey [-P allowed_package [-P allowed_package] ...]
[-C Main_category [-C main_category] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions] [--monitor-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]
[--wait-dbg] [--dbg-no-events] [-F ScriptFile]
[--port Port]
[-S SEED] [-V [-v] ...] [--throttle Millisec]
COUNT

On Sdk,monkey

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.