This post describes a bug in Xcode 4.2.1 and a simple way to work around it. If you find it useful, please send me $5,000.00.
Xcode 4.2.1 has a bug (actually a set of related bugs) that can break the automated testing functionality for a project in certain conditions, such that the following things happen:
0.) Xcode gets confused, and uses the wrong executable for the project's Test action. This prevents the automated tests from being executed. This is the actual core of the bug.
1.) Compounding things somewhat, when this bug manifests, Xcode will tell the programmers that all their tests passed, when in fact Xcode didn't actually run any of their tests. That's bad, because it can easily go unnoticed for a while. The programmers may waste significant time writing code, thinking all tests are passing, only to then have to backtrack and rewrite when they realize that their new code is actually all wrong (something the failure of their existing tests would have alerted them to, had the tests actually been run).
2.) But those things are nothing compared to the insidious violence that this bug visits upon the programmers who try to figure out the cause and make it stop happening. This software defect can snare its victims in a web of deception that can take hours to unravel, and can result in the brutal and premature demise of any keyboards, mice, and even monitors that happen to be nearby.
A professional programmer has to have automated tests. Programmers argue about what kinds of tests to write, and when to write them, but not having tests at all is pure fuckery. Writing serious code without tests is for dilettantes and winos. Programmers need tests, which are typically run automatically by the programming toolchain when the code is built or run.
Mac programmers (and those iOS programmer weenies, too, as far as I've heard) pretty much have to use Xcode. There are insane convolutions that one might go through to avoid Xcode -- and indeed, most Mac programmers fantasize about this from time to time -- but generally speaking, Xcode is really the only game in town.
Mac programmers need Xcode and they need tests, so naturally they want Xcode to run their tests.
Therefore, when the programmers eventually notice that Xcode isn't running their tests, they will likely stop whatever else they are doing and try to fix it, by fiddling with the project settings. Most programmers would start by editing or recreating the project's Xcode schemes, which is logical, because the Xcode scheme controls, among other things, how and when to run the tests. They'll make a change or perhaps give up and rebuild the scheme from scratch (a minor pain in the ass), or maybe quit Xcode and revert the project file to the last checked out version. Most likely, they will see that after their changes, Xcode again properly runs their tests. The programmers will resume their work, and life will once again be fine, or at least okay.
But Xcode isn't through with those poor assholes. No, it has only just begun to fuck with them.