Search code examples
iosinstrumentsui-automationios-ui-automation

Run Instruments 4.3 from the cmd line?


I'm having trouble running Instruments 4.3 from the cmd line. I believe it's picking up my older 4.2 version which is still installed. How do I get Instruments 4.3 to install and launch my App then run UIAutomation against it?


Solution

  • The problem is that you're specifying the -w parameter but not supplying a device ID. If you're trying to run from your app in the simulator, then just leave out the -w like so.

    xcrun instruments -v \
      -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
      /Users/cliff/Src/MyApp/build/MyApp/Build/Products/Debug-iphoneos/MyApp.app \
      -e UIASCRIPT /Users/cliff/Src/MyApp/UIAutomation/automation-test.js \
      -e UIARESULTSPATH /Users/cliff/Src/MyApp/build/uiautomation
    

    If you really are trying to run this automation script on the device, then you can quickly grab the device ID by using this script I wrote. Hand that ID in to the -w parameter and it should work fine.