cedarbdd / cedar

BDD-style testing using Objective-C
http://groups.google.com/group/cedar-discuss
1.19k stars 140 forks source link

Register CDRXCTestObserver at init time instead #379

Closed idoru closed 8 years ago

idoru commented 8 years ago
idoru commented 8 years ago

Possible fix for issue raised by @cbguder

I like that this appears to comply with how Apple wants custom test observers registered (see the OpenRadar link). I'm not sure exactly how far back this support goes though?

This will also add additional setup steps (the addition of the Info.plist key in the test bundle).

idoru commented 8 years ago

...and it just struck me that if multiple frameworks used this approach then it wouldn't be possible to use them both.

Hmm...

briancroom commented 8 years ago

@idoru Thanks for taking steps towards resolving this. I'm not going to have a sufficiently reliable internet connection to download Xcode 7.3 myself until sometime next week.

What I'm actually wondering right now is whether we could get away with removing our test observer altogether. As far as I can tell, the swizzling done at https://github.com/pivotal/cedar/blob/master/Source/XCTest/CDRXCTestFunctions.m#L41 serves the same purpose of getting Cedar's XCTestCase subclasses added to the XCTestSuite instance that will be executed. I remember that we kept the swizzling in place to keep xctool happy, even after the XCTestObservationCenter started being used as well.

idoru commented 8 years ago

I gave that a quick test, and it seems like that mechanism isn't triggered on Xcode 7.3, but haven't had time to look into why. I may have time to investigate further on Monday...

idoru commented 8 years ago

@briancroom Looking at this today. Looks like we'll have to intercept +testSuiteForTestConfiguration: as +allTests doesn't appear be called with Xcode 7.3

Expect new PR shortly.

idoru commented 8 years ago

Going with #382 to address this for now. Closing.