1, Monkey Test is an Android platform for automated testing of a fast and effective means, through the monkey tool can simulate the user touch screen, sliding trackball, buttons and other operations to the simulator or mobile device software on the pressure test, testing the stability of the software, robustness. Its principle is to send a pseudo-random user event stream (such as key input, touch input, gesture input, etc.) to the system for stress testing of the application under development.
2, basic usage of Monkey
Basic syntax is as follows:
$ adb shell monkey [options]
If you do not specify Options,monkey will start in a feedback-free mode and send events to all packages installed in the target environment. The following is a more typical command-line example that launches a specified application and sends 1000 pseudo-random events to it:
$ adb shell monkey-p your.package.name-v number
$ monkey-p (Package Specify the file name-V (number of times and frequency of test) numbers (number of times)
1) View APK package
A, enter the Data/data directory through the CD command, and then use the LS command to see the currently running package
B , adb Shell
# PM List Packages
2) View Activity
A, use command line AAPT dump Xmltree xx.apk androidmanifest.xml
B, adb shell D Umpsys window W |findstr \ |findstr name=
3, mokey test result Analysis
1) test results Export
adb shell monkey-p your.package.name-v numbe R>d:log.txt
2) test result analysis
ANR problem: Search for "ANR"
Crash issue in log: Search for "Exception"
3) event-S
Pseudo-random number generator seed value. If you run monkey again with the same seed value, it will generate the same sequence of events.
Log in to view specific system crash seed values, reproduce system crash test steps
4, End monkey process
Ps|grep monkey
Kill pid
Android Test Tool: Use Monkey test