specta icon indicating copy to clipboard operation
specta copied to clipboard

Xcode doesn't show correct test results

Open mfclarke opened this issue 9 years ago • 7 comments

Please see screenshot. When a test fails, the console reports the correct results (failure), but Xcode (6.3.2) shows green ticks. At first I thought this was because the code being tested raised an exception, but it also occurs if some tests pass and others fail.

screen shot 2015-06-03 at 10 45 12 am

mfclarke avatar Jun 03 '15 08:06 mfclarke

It's showing a green tick for the test that successfully passed, but not for the missing result. Perhaps we need to hook in to uncaught exceptions and raise an XCTFail. Any chance you can post the crashing code or can make a PR tackling this?

orta avatar Jun 03 '15 13:06 orta

The crashing code is simply [NSException raise:@"Forced Crash" format:@"Requested crash from -[CrashingObject crash]"]

I will have a crack at a PR if I have some spare time but I'm afraid that may not be for a week or two.

mfclarke avatar Jun 03 '15 14:06 mfclarke

We're experiencing similar issues. Restarting XCode is needed to solve the issue in Test navigator pane. The Xcode test reports are showing the correct results reported in the console

blackivory86 avatar Jul 27 '15 15:07 blackivory86

I often clear my Derived Data directory to fix this, to be honest it's driving me crazy! haha, it seems to get screwed after a while, and then I cleanup Derived Data again.

Goles avatar Sep 02 '15 20:09 Goles

This seems to be an issue with XCTest and Xcode. What I'm seeing is that the second time the you run a spec similar to the one above, the last test does not appear on the test navigator.

Since Quick is suffering with the same problem, I guessed that the problem might not even be Specta, but XCTest.

So I did what the core of Specta does, which is to create the test on runtime by overriding +[XCTestCase testInvocations] and creating some tests at runtime.

It's something like this. It creates 3 tests a at runtime

The Test Navigator will report only 2 tests running, even though the report and the console will report 3 correctly.

What's more interesting is that the results on test navigator are correct until the method -[_XCTestDriverTestObserver testBundleDidFinish:] is hit. During the execution of that method, the test navigator is updated and one result disappears..

I tested Specta, Quick and Cedar and all of them had this behaviour, what makes the point that the Test Navigator and runtime tests are not in their best terms currently.

dbarden avatar Dec 11 '15 05:12 dbarden

Potentially related to https://github.com/Quick/Quick/issues/373, with a proposed solution here: https://github.com/Quick/Quick/issues/439.

modocache avatar Dec 11 '15 05:12 modocache

+1, currently there is no way to run single file (even with fdescribe and fit), and when you have lots of tests it's pretty annoying running them all every time.

oronbz avatar Mar 23 '16 10:03 oronbz