vigossjjj / CrashMonkey4IOS

iOS Monkey Test Tool.
MIT License
344 stars 135 forks source link

CrashMonkey4IOS

iOS Monkey Test Tool.

简要说明:

  1. 支持真机测试、模拟器测试
  2. 支持收集系统日志(Systemlog)崩溃日志(Crashlog)instrument行为日志
  3. 支持测试报告截图,绘制行为轨迹
  4. 支持测试设备信息收集
  5. 使用最新版的UIAutoMonkey,加入UI HolesApplication Not Repsonding ("ANR")的处理,添加custom.js作为入口脚本.
  6. 加入tuneup依赖
  7. 修改UIAutoMonkey.js中截图策略,为每个Event Action进行截图
  8. 支持测试执行过程中App进入后台,自动恢复(测试不会block)

系统及环境要求:

  1. 安装Ruby运行环境,建议不要使用OS X自带版本,可自行使用RVM(Ruby Version Manager)安装最新版的Ruby。安装好RVM后建议使用淘宝镜像安装ruby,

    $ sed -i -e 's/ftp\.ruby-lang\.org\/pub\/ruby/ruby\.taobao\.org\/mirrors\/ruby/g' ~/.rvm/config/db

  2. 确保gem可用,也建议使用淘宝镜像:

    gem sources --remove https://rubygems.org/

    gem sources -a https://ruby.taobao.org/

    gem sources -l

  3. 安装Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  4. 建议Xcode 6.x +

必要依赖安装:

  1. brew install -HEAD ideviceinstaller
  2. brew install libimobiledevice
  3. brew install imagemagick

使用说明:

安装Release版

gem install smart_monkey, 执行入口: 终端下直接使用smart_monkey

安装开发版

安装Ruby模块gem install erubis(如安装release版,此模块会自动配置加载。) 直接clone本项目, 执行入口: /CrashMonkey4IOS/bin/smart_monkey

执行命令

smart_monkey -a ${App_BunnelID} -w ${iPhone_UDID}

参数说明:

⇒  CrashMonkey4IOS/bin/smart_monkey -h
Usage: smart_monkey [options]
    -a app_name                      Bundle ID of the desired target on device(Required)
    -w device                        Target Device UDID(Required)
    -n run_count                     How many times monkeys run(default: 1)
    -d result_dir                    Where to output result(default: ./smart_monkey_result)
    -t time_limit_sec                Time limit of running
    -s dsym_file                     Use .dSYM file to symbolicating crash logs
    -c custom_cfg_path               Indicate confige lib directory path, not a file path.
        --event-number event_number  The monkey event number(default: 50)
        --compress-result compress_rate
                                     compress the screenshot images to save disk space!(example: 50%)
        --detail-count detail_event_count
                                     How many events to show in detail result page(default 50)
        --show-config                Show Current Configuration custom.js
        --drop-useless-img           Delete the un-displayed images of detial page.
        --list-app                   Show List of Installed Apps in iPhone/iPhone Simulator
        --list-devices               Show List of Devices
        --reset-ios-sim              Reset iPhone Simulator
        --version                    print smart monkey version

Troubleshooting:

安装和执行测试遇到的问题解决方案请参看:Troubleshooting.md

测试报告:

Summary:

summary

Detail:

detail

SystemLog:

systemlog

CrashLog:

crashlog

uiautotrace:

uiautotrace

参考文献:

  1. https://github.com/mokemokechicken/CrashMonkey
  2. https://github.com/jonathanpenn/ui-auto-monkey