无法 运行 命令行 iOS UI 自动化

Unable to run command line for iOS UI Automation

我使用了这个网站的模板:http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation 并创建了我自己的命令行 运行 在终端上进行自动化测试。

以下是关于我的脚本的一些有用信息:

  1. 我正在使用 xCode 6.4.

  2. 我在 Xcode 工具中 运行 这个自动化脚本,它工作正常。

这是我的命令行:

instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js

但是我收到了这个错误:

2015-10-05 14:16:34.122 instruments[23330:551118] WebKit Threading Violation - initial use of WebKit from a secondary thread. Instruments Usage Error : Failed to resolve target for Instrument 'Automation' instruments, version 6.4 (57082) usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]] tio-spare:~ wendywang$ ConsumeriOS -e UIASCRIPT /Users/wendywang/Documents/xxx/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js -bash: ConsumeriOS: command not found

我仔细检查了一下

  1. UDID 正确
  2. 自动化跟踪模板在正确的路径中
  3. LogIn.js 文件在正确的路径中

有一件事我不确定:

ConsumeriOS 是代码的名称。但在代码内部,它实际上可以生成一些应用程序。我正在测试名为 Consumer 的应用程序。所以我不确定应用的名字是应该写ConsumeriOS还是Consumer。

有谁知道为什么会产生这个错误?谢谢!

呼呼,

试试这个:

给出

  1. 带有 .app 扩展名的应用的完整路径,
  2. 将DeviceID和脚本放入"",
  3. 用设备名试试,如果不行 工作。

这是一个适合我的示例。

instruments -w "DeviceID" -t PATHTOTEMPLATE/Automation.tracetemplate PATHTOAPP/ConsumeriOS.app -e UIASCRIPT "PATHTOSCRIPT/UITest.js"

告诉我!

相关留言是这条:

tio-spare:~ wendywang$ ConsumeriOS -e UIASCRIPT /Users/wendywang/Documents/xxx/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js -bash: ConsumeriOS: command not found

看来您可能已经复制粘贴了这条命令:

instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js

但不正确 -- 在两个单独的部分中,第 1 部分:

instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate

和第 2 部分(以换行符分隔):

ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js

另外,您似乎写了应用名称 (ConsumeriOS) 而不是应用的完整路径 (/path/to/ConsumeriOS.app)。