【发布时间】:2012-12-05 02:04:55
【问题描述】:
有人成功在 Xcode 中设置自动化 UIAutomation 测试吗?
我正在尝试在我的 Xcode 项目中设置一个目标,该目标应该运行我准备的所有 UIAutomation 脚本。目前,这个目标的唯一Build Phase是这个Run Script块:
TEMPLATE="/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"
MY_APP="/Users/Me/Library/Application Support/iPhone Simulator/6.0/Applications/564ED15A-A435-422B-82C4-5AE7DBBC27DD/MyApp.app"
RESULTS="/Users/Me/Projects/MyApp/Tests/UI/Traces/Automation.trace"
SCRIPT="/Users/Me/Projects/MyApp/Tests/UI/SomeTest.js"
instruments -t $TEMPLATE $MY_APP -e UIASCRIPT $SCRIPT -e UIARESULTSPATH $RESULTS
当我构建这个目标时,它会在几秒钟后成功,但脚本实际上并没有运行。在构建日志中,我收到以下错误:
instruments[7222:707] Failed to load Mobile Device Locator plugin
instruments[7222:707] Failed to load Simulator Local Device Locator plugin
instruments[7222:707] Automation Instrument ran into an exception while trying to run the script. UIATargetHasGoneAWOLException
+0000 Fail: An error occurred while trying to run the script.
Instruments Trace Complete (Duration : 1.077379s; Output : /Users/Me/Projects/MyApp/Tests/UI/Traces/Automation.trace)
我很确定,我的 javascript 和我的运行脚本都是正确的,因为如果我在 bash 中运行完全相同的仪器命令,它会按预期工作。 这可能是 Xcode 中的错误吗?
【问题讨论】:
-
您是否尝试过通过
xcrun运行仪器 - 也许这有助于正确设置其环境?例如xcrun instruments -t [...] -
哦,要获得更多灵感,请看一下我与同事开始的一个小项目:jenkins-automation。
-
我得到了相同的结果。很奇怪,因为你似乎也在做同样的事情。但是你在 Xcode 之外运行这个脚本,对吗?我的问题是,如果我尝试将它作为目标运行,它就不起作用。如果我只是在终端上运行脚本就可以了。
-
是的,该脚本是通过 Jenkins 在 Xcode 之外运行的。
标签: xcode instruments ui-automation