Search code examples
iosobjective-cxcodemacosxcodebuild

Xcode5 cmd-line tests - simulator, device, and OSX


Xcode5 includes better support for cmd-line tests. For example, I can run iOS tests with the following:

Simulator Tests

xcodebuild -workspace ${module.name}.xcworkspace test -scheme ${module.name} -destination OS=7.0,name=iPhone -destination-timeout=10 -configuration Debug

Device Tests

And it is now possible to execute tests on the actual device hardware by specifying the device's name:

xcodebuild -workspace ${module.name}.xcworkspace test -scheme ${module.name} -destination id=${device.name} -destination-timeout=10 -configuration Debug

OSX Tests

What is the correct cmd-line for executing OSX tests?


Solution

  • According to the man page you need to specify the platform as 'OS X' and optionally the arch which can be x86_64 (default) or i386, eg.

    xcodebuild test -scheme {schemename} -destination platform='OS X',arch=x86_64
    

    If you're just building with the default destination though i've also found that you can omit the destination flag entirely