munmunbb
munmunbb

Reputation: 417

Unable to run command line for iOS UI Automation

I used the template from this website: http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation and created my own command line to run the automation test on terminal.

Here are some useful information about my script:

  1. I'm using xCode 6.4.

  2. I ran this automation script in Xcode instrument and it works fine.

Here is my command line:

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

But I received this error:

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

I double checked that

  1. The UDID is correct
  2. The automation trace template is in the correct path
  3. The LogIn.js file is in the correct path

One thing I am not sure:

The ConsumeriOS is the name of the code. But inside the code, it can actually produce a few apps. I am testing the app called Consumer. So I am not sure if I should write ConsumeriOS as the name of the app, or Consumer instead.

Does anyone know why it is generating this error? Thanks!

Upvotes: 0

Views: 598

Answers (2)

Ian
Ian

Reputation: 11850

The relevant message is this one:

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

It appears that you may have copy-pasted this command:

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

But incorrectly -- in two separate pieces, part 1:

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

And part 2 (separated by a newline):

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

Separately, it looks like you wrote the name of your app (ConsumeriOS) instead of the full path to your app (/path/to/ConsumeriOS.app).

Upvotes: 0

emoleumassi
emoleumassi

Reputation: 5149

Huhu,

try this:

Give the

  1. complete path to the app with the .app extension,
  2. Put the DeviceID and the script into "",
  3. try it with the device name, if it doesn't work.

Here a sample that works for me.

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

Let me know!

Upvotes: 1

Related Questions