4

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.

Philip Guin
  • 1,414
  • 15
  • 21

2 Answers2

5

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.

Community
  • 1
  • 1
ma11hew28
  • 106,283
  • 107
  • 420
  • 616
  • Cool, I like it. Can you declare variables within a given 'context()' so that following 'it()' statements can use them? – Philip Guin May 30 '11 at 21:55
  • Yes, the same way you do with Cedar or anywhere Objective-C blocks are used for that matter: `__block id variable = @"variable value";` See http://www.kiwi-lib.info/specs.html for an example. – ma11hew28 May 30 '11 at 22:26
1

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.