Today I conducted the Android Test Tool Monkey learning.
Monkey features include: (1) The object of the test is only the application package (APK package), there are certain limitations, (2) The Monkey test uses the event flow data flow is random, can not be customized, (3) can be Monkey test objects, the number of events, type, frequency and other settings.
Monkey is a command-line tool that contains a number of operations, which can be divided into four categories: (1) Basic configuration operations, such as setting the number of events to test, (2) operational constraints, such as restricting testing in a single package, (3) event type and frequency, and (4) debugging operations.
When the monkey runtime generates an event sequence and sends it to the system, it also observes the system in the test and looks for three special treatment conditions: (1) If the user constraints Monkey run in one or more specific packages, it observes the attempt to browse to the other package and blocks the actions ; (2) If an application crashes or receives an exception of any kind that cannot be handled, monkey will stop running and report an error, (3) If the application generates an unresponsive error, Monkey will stop running and report an error.
Monkey is a tool that comes with the Android platform, so you can launch it directly from the Android SDK on the machine.
The basic commands for executing monkey are:
$ adb shell [options]
Copy the APK file to be tested to the Android SDK corresponding to the Platform-tools directory, 3-1:
Figure 3-1 the location of the Monkey test application
Connect the Android device to your PC with a data cable, detect if the Android device is connected successfully to the ADB devices, connect successfully 3-2, execute the command to install the application to Android device, 3-2.
Figure 3-2 Detecting whether the mobile device (mobile phone) is connected to the computer successfully
Execute command:
$ adb shell monkey-p com.smorgasbork.hotdeath-v--throttle 2000-s 798
Test the Hotdeath, results 3-3, figure 3-4. Figure 3-3 shows the 11 types of things that monkey generates and the percentage of total events, such as sequence 0 for touch events, 1 for Action events, 2 for track events, 3 for navigation events, 4 for "primary" navigation events, 5 for System key events, and so on. In Figure 3-4, you can see the event actions generated by monkey in the run.
Figure 3-3 Monkey generating the event category
Figure 3-4 Event actions generated during the monkey test
This data is referenced in: analysis and comparison of the coverage of Android application testing tools--Huang Xiaowei
Small semester Software engineering team Project Progress 4