I took great pains to make sure Xcode 4.3 was the only version of Xcode on my system.
I created a new project (with Git and unit tests). To this project I added a new configuration, copied from Debug, called 'Coverage'. In the project (not 'main target', but 'project') I enabled 'test on build' for the Coverage configuration. In the main target, I enabled both 'test coverage' and 'instrument program flow' for the Coverage configuration.
I also added a new scheme, copied from the only other scheme, called 'Coverage' as well. The only difference in this scheme is checking the 'run' box for the test project in the build action.
I have not changed the DerivedData location in Xcode's preferences.
Okay, that's the setup.
When I run xcodebuild -configuration Coverage -sdk iphonesimulator -scheme Coverage build, the output goes to the DerivedData folder as expected and code coverage data is created as expected (after tweaking a script in Xcode, something about TEST_HOST).
When I run xcodebuild -configuration Debug -sdk iphonesimulator build, the output goes to the build directory in the project root. Same with xcodebuild -configuration Release -sdk iphoneos build.
How can I get these standard configurations to generate artifacts in the 'correct' (DerivedData) folder?
Bonus question: is there a better way to fix that TEST_HOST thing?