iOSApp -Monkey测试

时间:2023-03-17 15:23:26

IOS操作系统不像Android系统那么方便,各种限制也比较多,目前我的建议还是直接在模拟器上执行monkey测试。如果需要在真机上面执行,可以参考文档: http://testerhome.com/topics/2523

      本文介绍怎么使用开源工具CrashMonkey进行IOS的monkey测试,步骤如下:
      一、安装测试环境
           (1)MAC OS
           (2)XCode
           (3)Ruby,至少1.8版本以上
            Ruby的安装方法见:http://blog.csdn.net/li_huifeng/article/details/44456925,大致一下几 步:
           1、安装RVM:
                 curl -L https://get.rvm.io | bash -s stable
           2、载入RVM环境
                  source ~/.rvm/scripts/rvm
           3、检查RVM安装是否成功
                  rvm -v
           4、安装Ruby环境
                  rvm install 2.0.0
           5、设置Ruby版本
                 rvm 2.0.0 --default
           6、重新设置Ruby的默认源  
                 gem source -r https://rubygems.org/       
                 gem source -a https://ruby.taobao.org
           7、验证是否重新设置成功
                 gem sources -l
       二、安装CrashMonkey,参考链接:https://github.com/mokemokechicken/CrashMonkey
          1、安装命令:gem install crash_monkey --no-ri --no-rdoc
       三、使用CrashMonkey
          1、使用命令:crash_monkey -a APP_NAME or APP_PATH -w DEVICE
       四、直接使用instruments命令执行monkey:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -w EE564527-433A-42E3-92B8-F73A3EC0C8E7 /Users/xiehao/Temp/MYBPortal.app  -e UIASCRIPT /Users/xiehao/program/CrashMonkey/bin/crash_monkey_result/UIAutoMonkey.js -e UIARESULTSPATH  /Users/xiehao/program/CrashMonkey/bin/crash_monkey_result