问题
So I've been searching pretty hard for a solid BDD alternative for iOS4 and Xcode4, but everything seems to have either been abandoned a long time ago or sortof working but rather messily. The best solution I've found is called Cedar (main article with a link to a recently updated project tracker), though it has some issues with Xcode4 involving a messy workaround, as noted here. Does anyone know of a better solution? Thanks!
EDIT: I decided on using OCUnit and mushing the BDD syntax into the test names. This is not my ideal solution, especially since all test names must be prefixed with the word "test" (ERRGGHH!!!), but I simply could not get Cedar working for the life of me. OCHamcrest (a popular matching library) makes this MUCH more tolerable, but something that allows for UI testing, that doesn't compile anything directly into your code, is in Objective-C, and can be used in Xcode would still be absolutely scrumptious.
回答1:
I've tried Cedar. I prefer Kiwi. It's Awesome! It works well with iOS4 and Xcode4, it's easy to set up, the documentation is good, and it has its own methods for matchers, expectations, mocks, stubs, etc. like RSpec. So, it's all you need. You don't need OCHamcrest
or OCMock
.
Here's a crazy example I put together: https://gist.github.com/997581
Also, see iOS Tests/Specs TDD/BDD and Integration & Acceptance Testing.
回答2:
Try calabash, works great and it's very easy to start. You can see an example of how to use it step by step in BDD From the idea to the App.
来源:https://stackoverflow.com/questions/6036891/is-there-a-bdd-solution-that-presently-works-well-with-ios4-and-xcode4