Xcode Command Line Tool (XCode 4.6) Run Unit Tests from terminal

command-line, jenkins, terminal, xcode4.6

Solution

You could also upgrade to Xcode 5, which allows for the command:

xcodebuild test -scheme SomeTestScheme -destination "name=iPhone Retina (4-inch)"

Note: the destination parameter should match the visible name for the destination you want the test run on.

Problem

after many attempts, I didn't figure how I can run unit tests by terminal with a project that is inside a workspace. I tried to create a new Scheme and run that script which builds but doesn't run any tests: ``` export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/ xcodebuild -workspace MyProject.xcworkspace\ -scheme MyProjectLogicTests\ -sdk iphonesimulator\ -configuration Debug\ ONLY_ACTIVE_ARCH=NO\ TEST_AFTER_BUILD=YES\ RUN_APPLICATION_TESTS_WITH_IOS_SIM=YES\ clean build ```

Original source