4

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
Ludovic Landry
  • 11,606
  • 10
  • 48
  • 80
Raphael Oliveira
  • 7,751
  • 5
  • 47
  • 55

1 Answers1

7

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.

Raphael Oliveira
  • 7,751
  • 5
  • 47
  • 55
BadPirate
  • 25,802
  • 10
  • 92
  • 123