2015-10-06 34 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)。