Android Automatic test Tool monkey_android

Source: Internet
Author: User
Tags time interval

Objective:

Recently began to study the Android automated test methods, some of these tools, methods and frameworks to do some simple collation, including the Android test framework, CTS, Monkey, Monkeyrunner, benchmark, other test tool, and so on. Due to contact time is very short, many places have deficiencies, I hope to communicate with you a lot.

I. Definition of Monkey

Explore the software testing tools, this article mainly introduces monkey tools. Monkey Test is an Android platform automated testing means, through the monkey program to simulate the user touch screen, sliding, buttons and other operations to the device on the pressure test, the detection of the program how long time will occur abnormal. The time interval for each operation is set by our testers through the parameters, and normally, we set the time interval of 500ms for each operation.

Monkey Program Introduction:

The monkey program is brought by the Android system, written in the Java language, and stored in the Android file system:/system/framework/monkey.jar

Note: The Monkey.jar program is initiated by a shell script called "Monkey", where the shell script is stored in the Android file system:/system/bin/monkey;

This allows the monkey test to be performed by executing in the cmd window: adb shell Monkey {+ command parameters}.

Ii. Characteristics of Monkey

1, the object of the test is only the application package, has certain limitations.

2, Monky test use of the event flow data flow is random, can not be customized.

3, can the Monkeytest object, the number of events, type, frequency and so on set.

Iii. Basic usage of monkey

The basic syntax is as follows:

$ adb shell monkey [options]

If Options,monkey is not specified, it will start in no feedback mode and send the event to any package installed in the target environment. The following is a more typical command-line example, which launches the specified application and sends 500 pseudo random events to it:

$ adb shell Monkey-p your.package.name-v 500

Iv. An example of 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.

Windows (Note: 2-4 step is to see what we can test which application packages can be omitted):

1. Launch an Android emulator via eclipse

2, in the command line input: 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, in the command line input: adb shell into the shell interface

C:\Documents and settings\administrator>adb Shell

#

4, view the application packages under the Data/data folder. Note: The application packages 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 package –v represents the level of feedback information

During the run, applications in the emulator are constantly switching the screen.

Depending on the level of feedback you select, you can also see its execution process reports and generated events in monkey.

Note: The specific parameters of the setting can refer to:

Http://developer.android.com/guide/developing/tools/monkey.html

V. Conditions of termination for monkey testing

Monkey test is automatically stopped in the following three situations:

1. If the monkey is defined to run on one or several specific packages, it will monitor and block attempts to move to another package.

2, if the application crashes or receives any runaway exception, Monkey will stop and error.

3. If the application produces an error that the application does not respond to (application not responding), Monkey will stop and make an error.

It is a stable enough program to pass multiple and different sets of monkey tests.

About the Android Automatic test tool monkey related knowledge to introduce so many, follow-up will continue to update the money testing tools related knowledge, please pay attention.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.