cedarbdd / cedar

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

Add support for Facebook's xctool #308

Closed parse closed 9 years ago

parse commented 9 years ago

Related to: https://github.com/facebook/xctool/issues/417

It would be awesome to be able to run Cedar in xctool.

Thanks

akitchen commented 9 years ago

Hey @parse thanks for cross-linking that issue. Yes, Faceboook xctool support would be nice. We'll spend some time looking into it via the info referenced in that issue and follow up soon.

timrosenblatt commented 9 years ago

Hey Andrew, I just wanted to bump this. I work at Ship.io and we really want to be able to support Cedar for our users, but it doesn't work right now because of the xctool incompatibility. Do you have a sense of what changes need to be made for it to work?

stamhankar999 commented 9 years ago

I second that!

eileenchow commented 9 years ago

I third that!

akitchen commented 9 years ago

Thanks for all the bumps on this thread, it's good to gauge interest in this issue. I realize I neglected to add more info earlier after spending some time investigating while between projects.

Unfortunately, this incompatibility boils down to how xctool discovers test cases - it expects them to be XCTestCase subclasses, which Cedar's specs are not. While Cedar fully supports running specs inside an XCTest bundle alongside XCTestCases, it is not as tightly coupled to XCTest as other third party testing frameworks. We also use our spec classes outside of bundles for test harnesses and other kinds of testing infrastructure, for which XCTest is not well suited.

To address this, Cedar would need to couple more tightly with XCTest, or xctool would need some additional work to be aware of Cedar specs. I haven't checked, but I assume that xctool might not work with GHUnit for the same reason.

Unfortunately we probably won't have bandwidth to patch xctool or Cedar for this issue in the near future, at least not during working hours due to project load. If anyone who uses xctool more regularly wants to try their hand at a patch, please refer to the helpful links in the corresponding issue thread https://github.com/facebook/xctool/issues/417 .

tjarratt commented 9 years ago

Thanks to some wonderful investigatory work that @briancroom did recently, it is now possible to run Cedar specs that are setup as a Test Bundle with xctool, using the xctool test action. Running spec suites feels to be outside the scope of this, for some of the reasons that @akitchen enumerated.

@parse how do you feel about closing this issue? Is there any more we could do here to improve support?

alexbasson commented 9 years ago

FWIW, due to yesterday's merge, today @idoru and I started using xctool as part of our build process on GiveLively, and it's working great. Thanks for the great work, @briancroom!

On Thu, Oct 8, 2015 at 1:34 AM, Tim Jarratt notifications@github.com wrote:

Thanks to some wonderful investigatory work that @briancroom https://github.com/briancroom did recently, it is now possible to run Cedar specs that are setup as a Test Bundle with xctool, using the xctool test action. Running spec suites feels to be outside the scope of this, for some of the reasons that @akitchen https://github.com/akitchen enumerated.

@parse https://github.com/parse how do you feel about closing this issue? Is there any more we could do here to improve support?

— Reply to this email directly or view it on GitHub https://github.com/pivotal/cedar/issues/308#issuecomment-146425199.

briancroom commented 9 years ago

For future reference in case this breaks again, the code within xctool that was failing to find the Cedar specs is located here, in the otest-query helper tool. Previously, the XCTestSuite instance retrieved by that line contained no tests. Cedar is now swizzling the allTests method to add the specs as a child suite before returning it.

tjarratt commented 9 years ago

Thanks @briancroom for all your help in getting this working.