UIAutomation: 通过命令行运行测试用例

发表于:2014-5-15 10:22

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:qqgirllianxin    来源:51Testing软件测试网采编

  为了实现自动定时的运行脚本,我们需要在命令行运行和启动脚本,具体代码如下:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
<full_path_to_application>
-e UIASCRIPT <path_to_script.js>
-e UIARESULTSPATH <output_results_path>
  1.  -t 后面的参数为 Automation.tracetemplate 的路径,每个版本的位置都有所不同,在命令行下使用 instruments -s 命令进行查询。
  2.  full_path_to_application 是你的的被测应用的完整目录,需要在前后加上双引号。
  3.  -e UIASCRIPT  指定执行的 js 脚本存放的位置,需要在前后加上双引号。
  4.  -e UIARESULTPATH  指定输出结果存放的路径,需要在前后加上双引号。
  5. 如果需要在真机运行,在-t 参数前加上  -w UDID, 其中UDID为被连接手机的设备标识(可通过iTools查看)。
  举例在我本地模拟器上的脚本如下:
instruments -t
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
"/Users/wangxinxin/Library/Developer/Xcode/DerivedData/TestAutomation-ahmqgmqipyidexemazbprqxqkrya/Build/Products/Debug-iphonesimulator/TestAutomation.app"
-e UIASCRIPT "/Users/wangxinxin/Documents/TestAutomation/test.js"
-e UIARESULTSPATH "/Users/wangxinxin/Documents/TestAutomation"
相关文章
UIAutomation: 登录界面测试实例
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号