(二)smart_monkey for ios 测试工具包.note

(二)smart_monkey for ios 测试工具包.note

smart_monkey for ios

工具包原文:https://testerhome.com/topics/2523

前提:

真机或模拟器上安装appdebug包;

简要操作步骤:

1. mac上安装homebrew,只需要一条命令行,从官网获取:http://brew.sh/ 

2. 安装brew成功后,执行以下三条命令

  Step 1. brew install libimobiledevice

 Step 2. brew install -HEAD ideviceinstaller

 Step 3. brew install p_w_picpathmagick

3. 以上工具包全部安装成功后,即可 开始运行smart_monkey; (如果是真机运行,需要打开权限,手机设置中“开发者”中启用“EnableUIAutomation”选项)

执行命令

smart_monkey -a ${App_BunnelID}

参数说明:

  • -a: 指向被测程序的BundleID(不可缺省)。e.g.-a com.mytest.app

  • -w: 指向测试设备的UDID,可以通过$instruments -s devices进行设备id的查看,若缺省则默认指向第一台设备(模拟器或真机)。e.g.-w 26701a3a5bc17038ca0465186407b912375b35a7

  • -n: monkey测试的执行次数,默认为1次。e.g.-n 3

  • -d: 测试报告地址,默认为当前目录下的smart_monkey_result文件夹下。e.g.-d ~/my-monkey-test-result

  • -t: 执行时间,单位为秒。e.g.-t 60

  • -s: 指向被测app的.dSYM文件,若出现crash,解析crash为明文。e.g.-s testapp.dSYM

  • -c: 自定义的配置集路径,参数必须为目录,目录下必须包含custom.js,若使用handler,目录下需存在名为handler的文件夹,用于存放相关文件。e.g.-c /my/path/custom_cfg

//遇到问题可查阅:https://github.com/vigossjjj/CrashMonkey4IOS/blob/master/Troubleshooting.md

4. monkey运行成功后 生成的报表位置:/user/smart_monkey_result

生成的结果包含有:运行时截图png列表、resutl.html 、系统日志、运行时完全日志等

云笔记 实践 得到结果如下

1. monkey 运行完成后,结果生成 为 report_日期 格式,存在本地,下图为一个report中的内容;

结果中包含这一次monkey运行中的所有截屏和日志和最终结果统计;

(二)smart_monkey for ios 测试工具包.note

2. 图1中的result.html为完全的结果统计,如果有失败的情况,会在里面列表;

下图为云笔记 未出现crash的结果统计,图中的3个tab可以点击查看具体日志;

(二)smart_monkey for ios 测试工具包.note

3. 整个运行过程中的monkey操作记录日志,在uiautomation.html 里

(二)smart_monkey for ios 测试工具包.note

使用smart_monkey的好处:结果统计明确,生成报表格式;

缺点还在研究中。。。

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