I have written a few unit tests in the new XCTest framework of Xcode 5.
The tests seem to pass successfully most of the time, but I've come across a strange behaviour where if I run the tests enough times consecutively, eventually I'll get a 'test failed' message and the console will show Program ended with exit code 0
, but there are green checkmarks beside all the tests.
What's going wrong here?
Despite the test I'm using is logic tests, Xcode wants to iPhone simulator to be running. Once in the agony of trying to get tests working again I've reset the iPhone Simulator contents and Settings from it's menu, and this helped.
If you look at the output console, you should notice that Xcode starts running test suite:
but suddenly exits without running test cases:
and shows a notification that test failed.
Restarting Xcode only helps temporarily as the problem quickly comes back.
I stopped executing tests in Xcode and run all tests by command line using xctool.
Build Clean worked for me... sometimes anyways. Product -> Clean.