Monkey Test Tool For iOS

Related tags

Testing CrashMonkey
Overview

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.

  • Max OS X 10.8.4
  • Xcode 4.6.3(Build version 4H1503)
  • Ruby 1.8.7-p371

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

Features

Good Points

  • No need to modify the app's project.
  • It can specify the running period and times.
  • The results of Screenshots and Operations history can be shown as HTML.
  • the console log and crash report can be shown.
  • It is easy to be used from CI tools like Jenkins.

Restrictions

  • It can be run only in iPhone Simulator.
  • The test can not continue when another application(like Safari) is the most front. (detect and finish the test).
  • It can not input suitable characters like ID/Pass.

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)
  • in (1) case, an application is executed which matches the app's name installed in iPhone Simulator. If there are same name apps, the app of latest updated time is used.

  • in (2)(3) cases, an app which in the PATH is excuted. It is required that the app is built for iPhone Simlator.

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.

  • The Jenkins running User has Administration privilege.

  • In case Jenkins is running as slave, launch with X like following.

     javaws http://<SERVER>/computer/<NodeName>/slave-agent.jnlp
    
  • The first time a Jenkins Job runs in the Mac, if the dialog is displyed then input correct password.

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

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

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

Comments
  • RCov does not work with Ruby 2.0. Please use simplecov.

    RCov does not work with Ruby 2.0. Please use simplecov.

    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    
        /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
    creating Makefile
    
    make "DESTDIR="
    compiling 1.8/callsite.c
    1.8/callsite.c:2:10: fatal error: 'env.h' file not found
    #include <env.h>
             ^
    1 error generated.
    make: *** [callsite.o] Error 1
    
    
    Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rcov-1.0.0 for inspection.
    Results logged to /Library/Ruby/Gems/2.0.0/gems/rcov-1.0.0/ext/rcovrt/gem_make.out
    An error occurred while installing rcov (1.0.0), and Bundler cannot continue.
    Make sure that `gem install rcov -v '1.0.0'` succeeds before bundling.
    

    line16 in Gemfile should be if RUBY_VERSION > "1.9"

    opened by louiseyang 2
  • Fix for apps with spaces in path

    Fix for apps with spaces in path

    When the filename had a space in the path, it would not be able to find the correct folder in the DerivedData folder and it would also not find the right crash reports. This merge request should fix that.

    opened by berendkleinhaneveld 1
  • Converted example JS file to JSON file

    Converted example JS file to JSON file

    Crash Monkey can process a custom JSON config. However, the provided example file doesn't have the JSON format. This PR creates a new JSON file and deletes the old JS file.

    opened by skrach 1
  • change default README as English?

    change default README as English?

    • change default README as English(this repo is cool, README as english will be a good promotion )
    • add extend_javascript_path and --reset-iPhone-Simulator to README(I am sorry, I don't know Japanese)
    opened by jollychang 1
  • In latest Appium Desktop Version v1.0.0 on macOS not able to launch Android Emulator

    In latest Appium Desktop Version v1.0.0 on macOS not able to launch Android Emulator

    In latest appium Desktop Version v1.0.0 on macOS not able to launch Android Emulator if i give Desired capabilities - avd Emulator Name . .

    To successfully launch the Android Emulator i need to use Desired capabilities - avd Emulator Name . Desired capabilities - deviceName Again same Emulator Name .

    opened by Nischalapp 0
  • Some issue in monkey_runner.rb

    Some issue in monkey_runner.rb

    when i run smart_monkey -a {boundle id},it remaids me bellow,could you help me resolve it?

    sh: -c: line 0: idevicecrashreport -u AADA204E-F363-48C8-8B86-D12A308A9509 (Simulator) -e -k /Users/homeqa/smart_monkey_result/report_20170712153821/crash_1' Attempting iOS device system log capture via deviceconsole. Stop iOS system log capture. /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:201:indevice': undefined method strip' for nil:NilClass (NoMethodError) from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:86:inblock in run_a_case' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:603:in watch_syslog' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:81:inrun_a_case' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:48:in block in run' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:45:intimes' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/lib/smart_monkey/monkey_runner.rb:45:in run' from /Users/homeqa/.rvm/gems/ruby-2.4.0/gems/smart_monkey-0.5.0/bin/smart_monkey:58:in<top (required)>' from /Users/homeqa/.rvm/gems/ruby-2.4.0/bin/smart_monkey:23:in load' from /Users/homeqa/.rvm/gems/ruby-2.4.0/bin/smart_monkey:23:in

    ' from /Users/homeqa/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in eval' from /Users/homeqa/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in
    '

    opened by xuruijy 0
  •  uncaught JavaScript error: undefined is not an object (evaluating 'event.apply') on line 158 of UIAutoMonkey.js

    uncaught JavaScript error: undefined is not an object (evaluating 'event.apply') on line 158 of UIAutoMonkey.js

    Error: Script threw an uncaught JavaScript error: undefined is not an object (evaluating 'event.apply') on line 158 of UIAutoMonkey.js

    I keep getting this after a few seconds of running. Also seems like the UIAutoMonkey.js has not been updated in a while.

    https://github.com/jonathanpenn/ui-auto-monkey/blob/master/UIAutoMonkey.js

    opened by sagpatil 0
  • the script is not taking any screenshots

    the script is not taking any screenshots

    Hi,

    unfortunately I have the problem that script is not taking any screenshots while it is running. I start the script as it is described with:

    • crash_monkey -a /pathTo.app -w B9DECF10-E048-4823-83D5-7E34F91AFAE5
    • simulator is starting and swipes, pinches etc. are executed
    • unfortunately I con not see the "Screenshot is captured" in the console as it is described in the video below
    • when the script is running a report has been created and in the crash_monkey_result folder I can see the index.html

    but I only can see the console logs and the screenshots as it is described in the video here: https://www.youtube.com/watch?v=y5PZGVbLHtI&feature=youtu.be

    Did I missed something or is here an issue ?

    thanks for your help

    opened by Tomtombulla1 3
  • If crashmonkey runs to different app, how can it be detected?

    If crashmonkey runs to different app, how can it be detected?

    Hi Mokemokechicken, I wanna ask how do you detect if the UIA runs on different app? I notice in your demo (as attached screenshot) you can detect the different app and force to stop the current instruments task. But when I tried with your version it can't detect, the UIA just hangs over there unless manually taps it back. I also traced your code but not found relative coding. Can you give a hint how did you do that? Thanks!! screen shot 2015-05-15 at 2 39 12 pm

    opened by JohnnyWuMigme 1
Owner
Ken Morishita
森下 健
Ken Morishita
Test-To-Do-List - Test To Do List with core data

test-To-Do-List This is my first pet project with core data Launch screen Main s

Artem 0 Feb 26, 2022
test ios UnitTest and UITest

github_actions Bundlerの導入 fastlaneやiOSパッケージマネージャであるCocoaPodsはRubyのライブラリ 開発チームで使用するバージョンを揃えるためにBundlerを導入する bundlerのインストール gem install bundler Gemfile

SUGY 0 Nov 3, 2021
iOS Test Hasitha

Welcome to the Bidone iOS Coding Test! iOS Create a simple application with the list of orders from viewModel and display them in a list. When a user

null 0 Nov 12, 2021
iOS Test for Openbank by David Moreno Lora

MarvelMobileTest-iOS iOS Test for Openbank by David Moreno Lora Installation Clone the project and install the dependencies using pod install Once th

David Moreno Lora 0 Nov 16, 2021
iOS UI Automation Test Framework

Deprecation: EarlGrey 1.0 is deprecated in favor of EarlGrey 2.0 which integrates it with XCUITest. Please look at the earlgrey2 branch. EarlGrey 1.0

Google 5.5k Dec 30, 2022
A collection of useful test helpers designed to ease the burden of writing tests for iOS applications.

MetovaTestKit is a collection of useful test helpers designed to ease the burden of writing tests for iOS applications. Requirements Installation Usag

null 23 Aug 29, 2021
Alef Dev Test iOS

AlefDev тестовое задание iOS Задача Разработайте экран, где человек может заполн

null 0 Feb 25, 2022
Rapptr iOS Test Jimin Kim

Hello! Your task is to use the provided project to create the iOS app displayed

null 0 Dec 22, 2021
Mooviely - Mooviely Basic App for IOS Test

Mooviely Mooviely Basic App for IOS Test. Anasayfa Bu sayfa açıldığında ekranın

null 0 Feb 13, 2022
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!

OHHTTPStubs OHHTTPStubs is a library designed to stub your network requests very easily. It can help you: test your apps with fake network data (stubb

Olivier Halligon 4.9k Dec 29, 2022
BDD Framework and test runner for Swift projects and playgrounds

Spectre Special Executive for Command-line Test Running and Execution. A behavior-driven development (BDD) framework and test runner for Swift project

Kyle Fuller 392 Jan 1, 2023
The XCTest Project, A Swift core library for providing unit test support

XCTest The XCTest library is designed to provide a common framework for writing unit tests in Swift, for Swift packages and applications. This version

Apple 1k Jan 4, 2023
Test Library for Swift's Error Handling

CatchingFire CatchingFire is a Swift test framework, which helps making expectations against the error handling of your code. It provides for this pur

Marius Rackwitz 75 May 16, 2022
This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD

Apress Source Code This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD by Gio Lodi (Apress, 2021). D

Apress 57 Jan 1, 2023
This is a simple test app getting data from network to practice a tad bit.

test This is a simple test app getting data from network to practice a tad bit. Start Nothing fancy, no CocoaPods, just clone and run! Architecture Ju

null 1 Oct 9, 2021
Test case project for mackolik

Mackolik - iOS Developer - Test Case Gökhan Mandacı 28 Oct 2021 I developed a two-page app and a general purpose drop down widget for the Mackolik Tes

Gökhan Mandacı 0 Oct 28, 2021
This repo holds the code for Dubizzle & Bayut test App

DubizzleClassified This repo holds the code for Dubizzle & Bayut test App About App This is a simple app which basically fetches item list from the gi

Ghassan 0 Jun 2, 2022
Test task application based on Swift using CoreData, Alamofire, AlamofireImage and CocoaPods

iTunes Search Test task application based on Swift using CoreData, Alamofire, AlamofireImage and CocoaPods Features ?? Searching music albums by name

Alexander Zhukov 0 Oct 31, 2021
Test Technique pour LeBonCoin

Test Technique pour LeBonCoin Test Technique pour LeBonCoin Créer une application universelle (iPhone, iPad) en Swift. Celle-ci devra afficher une lis

Charfeddine 0 Nov 3, 2021