Home

Awesome

CrashMonkey

Japanese

About

This is a tool of monkey test(random operation test) for iOS applications. Please watch the demo movie. CrashMonkey uses UIAutomation and modified ui-auto-monkey for iPhone Simulator manipulation.

Environment

It is confirmed only in the following environment.

Ruby versions may be OK 1.9.x and 2.0.x.

Features

Good Points

Restrictions

Install

gem install crash_monkey --no-ri --no-rdoc

How to use

Simple Usage

crash_monkey -a <APP_NAME or APP_PATH> -w <DEVICE>

-a specify AppName or PATH. -w specify the device on which to run. A list of available devices can be obtained with crash_monkey --list-devices. In case no device is specified, it will take the first from the list.

Example

crash_monkey -a MyAwesomeApp.app                               # (1)
crash_monkey -a build/Debug-iphonesimulator/MyAwesomeApp.app   # (2)
crash_monkey -a ~/Library/Developer/Xcode/DerivedData/MyAwesomeApp-ffumcy/Build/Products/Debug-iphonesimulator/MyAwesomeApp.app # (3)

Options

% crash_monkey
Usage: crash_monkey [options]
    -a app_name                      Target Application(Required)
    -w device                        Target Device(Required)
    -n run_count                     How many times monkeys run(default: 2)
    -d result_dir                    Where to output result(default: ./crash_monkey_result)
    -t time_limit_sec                Time limit of running(default: 100 sec)
    -c config_path                   Configuration JSON Path
    -e extend_javascript_path        Extend Uiautomation Javascript for such Login scripts
    --show-config                Show Current Configuration JSON
    --list-app                   Show List of Installed Apps in iOS Simulator
    --list-devices               Show List of Devices
    --reset-iPhone-Simulator     Reset iPhone Simulator

-n

The times for monkey test excution.

-d

The directory for output results.

-t

Timeout seconds for one monkey test.

-c

Specify configuration file(JSON format) for UIAutomation library. The template is shown by --show-config option.(example)

-e

Specify extend Javascript file for UIAutomation library.
It could be used for login.(example)

--show-config

Output configuration for UIAutomation library by JSON format.(example)

--list-app

List apps for iPhone Simulator.

--list-devices

List devices (simulator and attached) on which the monkey can be run.

--reset-iPhone-Simulator.

Reset iPhone Simulator.

For Jenkins

CrashMonkey has CUI interface, so easy to use from Jenkins. There are a few notes.

Confirmation dialog from UIAutomation is displayed and stop tests.

The first time in the Mac CrashMonkey run, Instruments(UIAutomation) may display a confirmation dialog and require to input password.

In this case, the test can not run if the password is not entered. The following management may be valid.

Other conditions may be OK, but this is also work.

Troubleshooting

CASE: xcode-select is not set.

symptoms

% crash_monkey -a MyGoodApp.app
.....
Run: ["instruments", "-l", "100000", "-t", ........... ]
xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
.....

measures

Please specify the install path of Xcode by xcode-select.

ex)

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Contributing to CrashMonkey

Copyright

Copyright (c) 2013 Ken Morishita. See LICENSE.txt for further details.