Installation and use of crashmonkey4android

Source: Internet
Author: User

Installation and use of crashmonkey4android

Brief introduction

Crashmonkey4android, a product that relies on the CTS framework to transform native Monkey, has the following new features:

    1. Save each step of the
    2. Save Logcat
    3. Save information for each monkey event
    4. Analysis crash
    5. HTML report
    6. Open source, what you want to do, you can do, as long as you line, you can do
    7. Multi-Device Support
Environmental requirements
    1. Installing jdk1.6+ and configuring environment variables
    2. Installing the SDK and configuring environment variables
How to use

The following is an example of a Mac environment

The first step

Synchronize the Crashmonkey4androd_bin project to get the executable file, or download the ZIP package directly and unzip it.

Step Two

After decompression, the project directory structure is as follows:

To locate the cts-tradefed file in the Tools directory, double-click the Terminal window that appears:

(We can see that we support multiple devices)

Step Three

In Terminal input command: run cts --plan Monkey Press return , @Monkey run away.

Fourth Step

See report, there are 2 directories in the statistics directory repository of tools is important
1. Logs: Saving and log information during the test
2. Results: Save test Report

First go to results to open the report, a folder represents a test, we just have 2 devices, so generated 2 reports, into the file to find index.html, open:

There are crash versions:


index.htmlFor the Results Summary page, the hardware information for the test device (Hardware), the Applied Information (application), the test period (Span), and the results (Results) are shown. Below is a table in which result shows the time spent in the test (Duration) and the number of events Monkey (20). Click on the link in the result list to enter the detailed report:
No crash version:


crash version available

The detailed page shows the last 50 steps (less than 50 are all listed), the type of operation is drawn, and you can click on the picture to see the relevant Logcat information for that step. Also includes a 3 button (Crash Log button will be displayed when crash occurs), click system log to see the system log:

Clicking uiauto trace the button displays information about all the steps:

If there is a crash log button, will display a short message crash, currently just simple analysis of the ANR and Java crash information from Logcat, follow-up will study crash knowledge:

Extended Functionality

We can run cts --help-all get all the parameters that can be set by typing at the command line:

Test options:--p Packageof test app--a main activityof test app--v MonkeyEvent CountDefault:--throttle the delay time between the eventsDefault:--pct-tap percentageof TapEventDefault:25.0.--pct-motion percentageof motionEventDefault:0.0.--pct-nav percentageof navigationEventDefault:15.0.--pct-majornav Percentageof major navigationEventDefault:15.0.--pct-syskeys Percentageof systemKeyEventDefault:15.0.--pct-drag Percentageof drag EvnetDefault:30.0.--logcat-size the max numberof LOGCAT DataIn bytesTo captureWhen--logcat-On-failureIsOn. Should be a amount that can comfortably fitIn memory.Default:20480.--plan the test planTo run. --[no-]rebootDoNot reboot device after running some amountof tests.Default behaviorIsto reboot.Default:False. --[no-]Skip-device-info FlagTo control whetherto collect infoFrom device. Providing this flag would speed up test executionForShort Test runs but would resultIn required data being omittedFrom the test report.Default:False. --[no-]device-unlock Unlock DeviceDefault:False. --app-path Local App' s path--wifissdk wifi username--wifipsk wifi password--[no-]Skip-uninstall-app No uninstall Test appdefault: true.--monkey-log-size Monkey log size default: 10485760.-B,--[no-]bugreport take A Bugreport after each failed test. Warning:can potentially use a lot of disk space. default: false.--[no-]tracefile get trace file, in/data/anr/trace.txt default: false.  ' stdout ' logger options:--log-level minimum log level to Display. default:info. Valid values: [VERBOSE, DEBUG, INFO, WARN, error, assert]7     

The main focus is on the following properties:

  1. P: Test the app's package name.
  2. A: Test the main activity of the app, if the above two items are set correctly, monkey will keep the application interface for the application test specified above-p.
  3. Throttle:2 the interval between monkey events, which defaults to 300 milliseconds.
  4. Pct-tap: Click the percentage of events, default is%25.
  5. Pct-motion: Multi-point sliding event percentage, default%0, (not yet implemented).
  6. Pct-nav: The percentage of navigation events (the navigation event consists of events triggered by the left and right keys of the direction input device), and the default is%15.
  7. Pct-majornav: The percentage of the primary navigation event. (These navigation events usually result in action events in the UI interface, such as the middle key of the 5-way keyboard, the fallback button, the menu key), and the default is%15.
  8. Pct-syskeys: Percentage of system events. (These keys are usually reserved for use by the system, such as home, back, Start-call, End-Call, Volume-adjust), and default to%15.
  9. Pct-drag: The percentage of drag events, which defaults to%30.

    Currently only 5/6 is achieved, but the above number must be added to 100%.

  10. Reboot: Restart the machine, default is False, do not restart. If you want to reboot, just attach the parameter directly to the command line without having to add a true after, because the Boolen type is set differently than the others.
  11. Device-unlock: Unlock the phone, default is False, if the collection restarts, it is recommended to set this property to True. The unlocking principle is unlocked using the apk that comes with Appium.
  12. Skip-device-info: Whether to skip device information acquisition, default is False. Because the device information is used in our reports, we recommend that you do not set this property to True.
  13. App-path: If the app needs to be installed locally, setting the app path with this property will automatically install the app to the collection end.
  14. User name for Wifissdk:wifi
  15. Wifipsk:wifi's password

    Because the tool supports automatic connection to WiFi, your app needs to work with WiFi, set these two properties, it automatically detects network disconnection and

  16. Skip-uninstall-app: Whether to skip the stage of uninstalling the app, because if you sometimes want to uninstall an app after you install it with a local app, you can set the property to False. The default is not to uninstall.
  17. Monkey-log-size: If for an app test, the tool collects logs separately for the app, you can set the maximum number of logs to B.
  18. Bugreport: Whether to save bugreport information, default to False. If development wants to bugreport information, set this property to True.
  19. Tracefile: Whether to save the Trace.txt file, the file is located in/data/anr/trace.txt. This file is commonly used to analyze problems when crash occurs.

Installation and use of crashmonkey4android

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.