Objective:
Android Automated test tools, methodologies, and frameworks, including Android OID test Framework, CTS, Monkey, Monkeyrunner, benchmark, test tool, etc.
First, what is Monkey
Monkey is a command-line tool in Android that can be run in the emulator or in the actual device. It sends a pseudo-random user thing flow (such as key input, touch screen input, gesture input, etc.) to the system for stress testing of the application under development. Monkey testing is a fast and effective method to test the stability and robustness of the software.
Two, monkey features
1, the test object is only the application package, has certain limitations.
2, monky the event stream traffic used for the test is random and cannot be customized.
3, set the Monkeytest object, number of events, type, frequency, etc.
Three, the basic usage of monkey
The basic syntax is as follows:
$ adb shell monkey [options]
If you do not specify Options,monkey will start in a no-feedback 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 500 pseudo-random events to it:
$ adb shell Monkey-p your.package.name-v 500
Iv. An example of the monkey test
With this example, we can understand the steps of the monkey test and how to know which applications can be tested with monkey.
under Windows:
1. Launch an Android emulator via Eclipse
2. Enter in the command line: ADB devices view device Connectivity
C:\Documents and SETTINGS\ADMINISTRATOR>ADB devices
List of devices attached
emulator-5554 Device
3, on the premise of a device connection, enter in the command line: adb shell into the shell interface
C:\Documents and settings\administrator>adb Shell
4, with Com.android.calculator2 as the object of Monkeytest
#monkey-P COM.ANDROID.CALCULATOR2-V 500
Where-p indicates that the object package –v represents the number of events
During the run, the application in emulator is constantly switching the screen.
According to the different levels of feedback you have selected, you can also see their execution process reports and generated events in monkey.
V. About the stop condition of the monkey test
Monkey test will automatically stop in the following three scenarios during execution:
1. If monkey is qualified to run on one or several specific packages, it will monitor and block attempts to move to other packages.
2. If the application crashes or receives any runaway anomalies, the monkey will stop and error.
3. If the application produces an error that the application does not respond (application not responding), the monkey will stop and make a mistake.
It is a stable enough program to pass multiple and different sets of monkey tests.
The Monkey tool for Android automated testing