DevOps Zone is brought to you in partnership with:

Programmed Macs since Inside Mac came in 3-ring binders; programmed iPhones since the first day the SDK was downloadable. 51 apps in the App Store to date, and always looking for new and interesting contracts! Alex is a DZone MVB and is not an employee of DZone and has posted 138 posts at DZone. You can read more from them at their website. View Full User Profile

Behavior-Driven Development for your iPhone projects!

08.25.2011
| 4878 views |
  • submit to reddit
So let’s say you’re interested in Behaviour-Driven Development testing of your iPhone projects. But there isn’t anything to help out Objective-C like all the cool kids have, you say? Not so! Here is your introduction to Cedar:

 

BDD-style testing using Objective-C

… One of the things I found I miss most in testing Objective-C, Java, or C++, is the hierarchical structure for organizing tests that frameworks like RSpec or Jasmine provide. I find nested describes indispensable for managing orthogonal aspects of the classes under test, for handling preconditions, for eliminating redundant setup code, and for generally keeping my sanity. So, when I first heard about the addition of blocks in the GCC compiler for Objective-C the first application that came to mind was testing.

So, I wrote Cedar, a BDD-style framework for writing tests in Objective-C. The code is available here. Perhaps more importantly, Cedar is in its infancy so I’m interested in any suggestions and feedback. To that end, I created a public Tracker project for it here


and a followup post correcting people who thought it wouldn’t work for iPhone development:

BDD-style testing for iPhone projects

… I actually wrote Cedar specifically for testing iPhone OS projects we’re working on at Pivotal. To prove it, I’ve started a small public iPhone project that I’ve test-driven entirely with Cedar. You can get the project here (more on that in a bit); it should eventually allow you to log into Pivotal Tracker, see all the delivered stories in a given project, and accept or reject each one…


So that looks like that might be an interesting new development style to take up. Although, at this exact point in time, one might wait for that currently-NDA’d version of Xcode to be released before making any firm commitments…

h/t: iPhoneFlow!

References
Published at DZone with permission of Alex Curylo, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)