I haven’t written unit tests before in Xcode. I started to read Apple’s article on unit testing with iPhone development because I wanted to follow sound development principles with an agile approach. Not long into the guide, I got stuck. Literally. Using Xcode 3.2 on Snow Leopard caused Xcode to lock/hang during the build of the logical unit test. Same results after iPhone SDK 3.1 came out. I couldn’t find anything online either except a few people experiencing the same issue. In the system console (not Xcode console) I was seeing:
Xcode -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620
Xcode -runOperationInBackground raised an exception: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620
Needless to say, I was losing my mind. Finally, a user in the Apple Developer forums, “cde”, posted the following gem:
We have recently discovered the root cause of this problem.
People who are affected can work around it by (I hope you’re ready for this)…
…changing the Time Zone on your Build machine away from Central Daylight Time. (In six weeks you can change it back, and people in Mountain Standard TIme will be affected.)
No, seriously. Give it a try.
The problem is a single-character typo in a regular expression that parses the date stamp of the unit test. It causes it to miss the beginning of unit tests that are executed at -0500 or +0500 relative to GMT, so the end of those unit tests is unexpected, and it causes the build log parsing logic to initially hang and eventually crash.
As has been said, “Then I decided to use regular expressions, and I had two problems…”
So until it’s fixed, change your timezone to Pacific time.