8

I have a core project that does not run as an application, its only "product" is to build and run a script. This project was created in Xcode 3, and was working great. Running a build would run the test script, no hassle.

Upgrading to Xcode 4, my script no longer runs. I haven't made any changes to the project, but there are obviously some differences. I checked out the build settings, and it looks like the script is piping results to /tmp/RunUnitTests.out, and the contents of this file are:

/Developer/Tools/RunUnitTests:68: note: RunUnitTests exited without running tests because TEST_AFTER_BUILD was set to NO.

Where should this TEST_AFTER_BUILD variable be set? Is there a way to do it in the UI that I can't find, or do I need to set it somewhere else?

(I'm assuming that since Xcode 4 has reached Gold Master, it's safe to discuss these things?)

3 Answers 3

14

If you go to the project settings (click the folder icon, then the blue project file at the top), select your test target under TARGETS, select Build Settings, turn on All settings, find Unit Testing, The change "Test After Build" under the test target to yes.

4

I believe you can also find that same flag(Test After Build) in the Unit Tests section of the Build Settings for each target. It defaults to 'NO' so it needs to be changed.

3

Found it! I edited the "Run Script" build phase for my target, and changed the command from:

"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 1> /tmp/RunUnitTests.out

to:

export TEST_AFTER_BUILD=YES
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 1> /tmp/RunUnitTests.out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.