2015-10-06 35 views
0

我使用了本网站的模板:http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation,并创建了自己的命令行来运行终端上的自动化测试。无法运行iOS UI自动化命令行

这里有一些关于我的脚本的一些有用信息:

  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作为应用程序的名称或消费者来编写。

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

回答

1

乎乎的,

试试这个:

给这个

  1. 完整路径与.app扩展名的应用程序,
  2. 把的DeviceID和脚本到 “”,
  3. 尝试使用设备名称,如果它不 工作。

这里有一个适合我的示例。

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

让我知道!

+0

谢谢!我掌握了它:) – munmunbb

0

相关的消息是这一个:

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)。