views:

836

answers:

3

The recent upgrade to XCode 3.2.4 and iOS SDK 4.1 lead to that my unit tests are not working any longer with my iOS project. The project is currently only running on the simulator, not real hardware.

I tried to make a new blank project with a dummy test case added that will always pass, but it does not work either, giving me this result:

An internal error occurred when handling command output:
-[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x20176e320
An internal error occurred when handling command output:
-[XCBuildLogCommandInvocationSectionRecorder endMarker]: unrecognized selector sent to instance 0x201257de0

Is anyone else having issues with their test cases using XCode 3.2.4 and iOS SDK 4.1?

+2  A: 

My suggestion to fix your problem is to consider using GHUnit. It works with your existing SenTestCase classes, but it also has a set of testing classes/assertions. You just setup a new target and point at their driver class. You get a fully functioning test harness that can run your tests on both the simulator and real devices. I find it much easier and more robust than setting up a test bundle and having to manage all that.

http://github.com/gabriel/gh-unit

logancautrell
Appreciate the response but it doesn't solve the problem. I am getting the same error and would like to know how to fix it.
Patrick
It looks like it has to do with the logging code. I have no clue how to fix that. You'd probably just have to disable it as part of your build and run the unit tests manually :(
logancautrell
Not exactly an answer to my question, but nice though to now know about GHUnit.
leinz
+3  A: 

The workaround for the issue is posted in the Developer Forum of Apple. It works fine in my project. Visit the website and try it.

yusami
Sounds nice, except that this requires being a member of the paid developer programs.
leinz
The source code is posted in GitHub. http://gist.github.com/586296
yusami
+3  A: 

It seems to be a regression with some part of the reporting code not respecting timezone issues. The output is tagged as ending before it began, so gets very confused and chokes.

One work-around, that I found somewhere on Google, is to change the Run Script stage of the target.

Change

"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 

to

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

It’s working round the issue, rather than solving it, but does work.

Andy W
Runs fine now, thank you!
leinz
Does this provide any indication of whether the tests failed or not? Because if not, you might as well disable the Unit Test target altogether (so you know it's not running), rather than letting it run and hide the results (so you might forget and think it's passing).
benzado
As far as I can tell it just dumps the output into the build window without the fancy nesting that should happen, so you can still see the list of passed tests and/or errors. It doesn’t hide the results, so much as not format them.
Andy W