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 run开发者_运维百科s. 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?)
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.
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.
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
精彩评论