In 2014, with Xcode 6.0.1, you would do something like this to run UIAutomation tests on a simulator, naming your simulator after the -w switch:
instruments -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \ -w 'iPhone 5s' \ '/Users/sohail/Library/Developer/CoreSimulator/Devices/7232A640-A9D2-4626-A2AD-37AFFF706718/data/Containers/Bundle/Application/E71B915E-051D-4BEF-9083-34416D02EC91/RoadRunnerRadar.app' \ -e UIASCRIPT '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestRunner.js' \ -e UIARESULTSPATH '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestResults/'
If you want to run this on your device, instead of "iPhone 5s", as in the above snippet to work on the simulator, you must specify the UDID of your device. Then you can omit the long path of the application above and just specify the name of the application. Tools will be able to find it on the device.
Using my example above, but modified for a hypothetical device, it will look like this:
instruments -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \ -w '8532A640-A9C2-4626-A2AD-37AFFF706799' \ 'RoadRunnerRadar' \ -e UIASCRIPT '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestRunner.js' \ -e UIARESULTSPATH '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestResults/'
This is not checked when the device is called, so please check it. There is a bit of flexibility in ordering parameters.
I have a tested UI Automation Runner script that works fine for Xcode 6.0.1 and the simulator.
source share