idS*_*tar 4 command-line ui-automation ios-ui-automation ios8 xcode6gm
从命令行运行UIAutomation测试似乎经常在新的Xcode版本中破坏(根据过去的帖子判断).从未使用过命令行脚本,我从2012年发现了这篇文章:来自命令行的自动化仪器.
问题:我的命令返回没有错误,没有输出结果,没有任何记录到系统控制台.模拟器甚至没有启动!
检查一些更新路径(特别是自动跟踪仪器路径),我想出了这个命令.注意第一个参数中的路径(它与过去的Xcode版本不同):
instruments -t "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate"
"/Users/sohail/Library/Developer/CoreSimulator/Devices/7232A640-A9D2-4626-A2AD-37AFFF706718/data/Containers/Bundle/Application/D07FEC4B-76AD-4844-8362-08E771B81053/MyAppName.app"
-e UIASCRIPT "/Users/sohail/source/MyAppName/MyAppNameAutomationTests/TestRunner.js"
-e UIARESULTSPATH "Users/sohail/source/MyAppName/MyAppNameAutomationTests/TestResults"
Run Code Online (Sandbox Code Playgroud)
通过从这个要点中选择"原始",这可能更容易阅读.
当然:
TestRunner.js
我指定的上述文件可以在指定的路径中找到,并且可以使用Instruments应用程序以交互方式在Automation Instrument中成功运行.想什么?
我看到完全相同的问题,在明确提供-w $ DEVICE参数后,我的测试终于开始了
instruments -t /Applications/Xcode6.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate
-w "iPhone 5s (8.0 Simulator)" /path/to/my/TestApp.app -e UIASCRIPT /tmp/script.js -e UIARESULTSPATH /tmp
Run Code Online (Sandbox Code Playgroud)