Invoking a UIAutomation Test from the Command Line Using Xcode 6

Running UIAutomation tests from the command line seems to often break with new releases of Xcode (judging by past reports). I never used a command line script for this, I found this post from 2012: Automation tool from the command line .

Problem: My command returns without errors, without output results and without any entries on the system console. The simulator does not even start!

Checking some paths for updates (in particular, the path of the automation tracking tool), I came up with this command. Pay attention to the path in the first parameter (it differs from previous releases of Xcode):

instruments -t "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate" "/Users/sohail/Library/Developer/CoreSimulator/Devices/7232A640-A9D2-4626-A2AD-37AFFF706718/data/Containers/Bundle/Application/D07FEC4B-76AD-4844-8362-08E771B81053/MyAppName.app" -e UIASCRIPT "/Users/sohail/source/MyAppName/MyAppNameAutomationTests/TestRunner.js" -e UIARESULTSPATH "Users/sohail/source/MyAppName/MyAppNameAutomationTests/TestResults" 

It may be easier to read by selecting "raw" from this gist .

Of course:

  • I confirmed that the path specified for my .app actually exists; It appeared after a successful build and launch.
  • I confirmed that in my specified output folder ("TestResults") that nothing was actually registered.
  • I have confirmed that the above TestRunner.js file specified by me can be found at the specified path and successfully launched in the Automation Tool in an interactive mode using the Tools application.
  • I checked Apple Xcode6 / iOS8 with a preliminary version of the documentation (login required, see section heading, “Running the Script Automation Tool from the command line”), and nothing pops up at me as incorrect, as I am just aiming at the simulator.
My suspicion
  • I miss some flag or switch somewhere.

Anyone's thoughts?

+4
command-line ios8 ui-automation ios-ui-automation
source share
1 answer

I saw the same problem, after the explicitly -w $ DEVICE option was provided, my tests finally started

 instruments -t /Applications/Xcode6.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -w "iPhone 5s (8.0 Simulator)" /path/to/my/TestApp.app -e UIASCRIPT /tmp/script.js -e UIARESULTSPATH /tmp 
+5
source share