使用Xcode 6从命令行进行UIAutomation测试调用 [英] UIAutomation test invocation from the command line with Xcode 6

查看:210
本文介绍了使用Xcode 6从命令行进行UIAutomation测试调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从命令行运行UIAutomation测试似乎经常与新的Xcode版本(根据过去的帖子)。从未使用命令行脚本为此,我发现这篇文章从2012年:从命令行自动化仪器

Running UIAutomation tests from the command line seems to break often with new Xcode releases (judging by past posts). Having never used the command line scripting for this, I found this post from 2012: Automation Instrument from the Command Line.

问题:我的命令返回没有错误,没有输出结果,没有任何记录到系统控制台。模拟器甚至不启动!

The Problem: My command returns without error, without output results and without anything logged to the system console. The simulator does not even launch!

检查一些路径的更新(特别是,自动化跟踪仪器路径),我想出了这个命令。注意第一个参数中的路径(它与以前的Xcode版本不同):

Checking some of the paths for updates (notably, the Automation trace instrument path), I came up with this command. Note the path in the first parameter (it's different than in past Xcode releases):

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"

通过从此 gist 中选择原始来更容易阅读。

This might be easier to read by selecting "raw" from this gist.

当然:


  • 我验证了指定给我的.app实际存在的路径;

  • 我验证了在我指定的输出文件夹(TestResults),事实上没有记录。

  • 我验证了我指定的上述 TestRunner.js 文件可以在指定的路径中找到,并且可以与仪器应用程序交互地在自动化仪器中成功运行。

  • 我已检查Apple的Xcode6 / iOS8 预发布文档(需要登录;请参见标题,从命令行执行自动化工具脚本),并没有跳出我的错误,因为我只是针对模拟器。

  • I validated that the path specified to my .app actually exists; it came into being after a successful build and run.
  • I validated that in my specified output folder ("TestResults") that in fact, nothing got logged.
  • I validated that the aforementioned TestRunner.js file I specified, could be found at the path specified, and successfully runs in the Automation Instrument interactively with the Instruments app.
  • I've checked Apple's Xcode6/iOS8 pre-release documentation (login required; see section title, "Executing an Automation Instrument Script from the Command Line"), and nothing jumps out at me as wrong, since I'm just targeting the simulator.

  • 我错过了一些标志或切换到某处。

>

推荐答案

我看到完全相同的问题,在明确提供 -w $ DEVICE 参数后,我的测试终于开始

I saw the exact same issue, after explicitly provided -w $DEVICE parameter, my tests finally got started

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

这篇关于使用Xcode 6从命令行进行UIAutomation测试调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆