Monkey Tools
Objective:
Recently began to study the Android automated test method, some of the tools, methods and frameworks to do some simple collation, including Android test framework, CTS, Monkey, Monkeyrunner, benchmark, other test tool and so on. Because the contact time is very short, many places have the insufficiency, hoped can communicate with everybody.
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 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.
Ii. 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.
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 (Note: 2-4 steps are to see which application packages we can test, which can be omitted):
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. View the application package under the Data/data folder. Note: The application packages that we can test are all under this directory
C:\Documents and settings\administrator>adb Shell
# ls Data/data
LS Data/data
Com.google.android.btrouter
Com.android.providers.telephony
Com.android.mms
Com.android.providers.downloads
Com.android.deskclock
Com.android.email
Com.android.providers.media
Com.android.settings
Jp.co.omronsoft.openwnn
Com.android.providers.userdictionary
Com.android.quicksearchbox
Com.android.protips
Com.android.browser
Com.android.launcher
Com.android.term
Com.android.speechrecorder
Com.android.server.vpn
Com.android.defcontainer
Com.svox.pico
Com.android.customlocale
Com.android.development
Com.android.soundrecorder
Com.android.providers.drm
Com.android.spare_parts
Com.android.providers.downloads.ui
Com.android.fallback
Com.android.providers.applications
Com.android.netspeed
Com.android.wallpaper.livepicker
Android.tts
Com.android.htmlviewer
Com.android.music
Com.android.certinstaller
Com.android.inputmethod.pinyin
Com.android.providers.subscribedfeeds
Com.android.inputmethod.latin
Com.android.gallery
Com.android.systemui
Com.android.contacts
Com.android.phone
Com.android.sdksetup
Com.android.calculator2
Com.android.packageinstaller
Com.android.camera
Com.android.providers.settings
Com.thestore.main
Com.android.providers.contacts
5, 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.
Note: Specific parameters can be set for reference:
Http://developer.android.com/guide/developing/tools/monkey.html
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.
http://www.cnblogs.com/
Android Auto Test Monkey Tool