Search code examples
iosxcodeterminalinstrumentsios-ui-automation

Open specifed simulator from command line to execute automation trace


I am trying to open iOS Simulator using terminal to execute an automation test script. After some thorough research, I am able to open a simulator and instruments. By default, it is launching iPhone Retina simulator. But how can I open specified simulator&version Eg: iPad 2 - 7.0 version.

I have tried using instruments -w help from here, I have got an error like Instruments Usage Error : Unknown hardware device specified.

I have tried various sources, but i am helpless. Any idea how to launch specified simulator (if possible in XCode 5/6)?


Solution

  • In Xcode 5.1, instruments command-line tool supports specifying the simulator SDK and device type using the -w flag. To see a list of the supported simulator configurations as well as attached devices, execute below command in a Terminal window.

    $instruments -s devices 
    

    Example to run tests on iPhone simulator:

    $instruments\
    -w "iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1" \
    -t $TRACETEMPLATE AppLocation \
    -e UIASCRIPT Script.js \
    -e UIARESULTSPATH reportPath