table of Contents
3. How to use monkey (premise, have installed Java and Android environment)
1. What is Monkey
Monkey is a command line tool in Android, which can be run in an emulator or on an actual device. It sends a pseudo-random user event stream (such as key input, touch screen input, gesture input, etc.) to the system to implement stress testing of the application under development. Monkey testing is a fast and effective method for testing the stability and robustness of software.
2. Monkey basic parameters
For basic parameters, please refer to API: http://www.android-doc.com/tools/help/monkey.html
3. How to use monkey (premise, have installed Java and Android environment)
adb shell monkey [options]--->here refers to the parameters. If you do not specify options, Monkey will start in no feedback mode and send events to all packages installed in the target environment at will.
Four. Use process
- Turn on the phone to debug and connect to the computer (open cmd, enter adb devices to check whether the connection is successful)
- Enter the command in cmd to start the test
Five. Give an example
adb shell monkey -p com.vanchu.apps.guimiquan --ignore-crashes --ignore-timeouts --ignore-security-exceptions --monitor-native-crashes --pct-touch 100 --pct-syskeys 0 --throttle 100 -v -v 600000 >c:\monkey.txt
Analysis:
adb shell monkey (basic format)
-p com.vanchu.apps.guimiquan (specify the name of the package to be tested as com.vanchu.apps.guimiquan)
--ignore-crashes (Monkey will continue to send events to the system when the application crashes or any out-of-control exception occurs until the count is completed)
--ignore-timeouts (Monkey will continue to send events to the system when a timeout error occurs in the application until the count is completed)
--ignore-security-exceptions (Ignore the permission errors that occur in the application, and the Monkey continues to send events to the system until the count is completed)
--monitor-native-crashes (monitor and report crash events of native code in the Android system)
--pct-touch 100 (adjust the percentage of touch events to 100)
--pct-syskeys 0 (adjust the percentage of key events to 0)
--throttle 100 (insert a delay between events)
-v -v 600000 (provides more detailed information about the test run, such as a single event sent to your event)
>c:\monkey.txt(输出log)