TDD for an OSX app TDD for an OSX app xcode xcode

TDD for an OSX app


Yes, TDD is easy to do with Xcode as it includes unit testing out of the box (OCUnit was included in Xcode 2.1). See Apple's documentation and Xcode Unit Testing Guide for closer details on how to develop and run unit tests in Xcode.


There's nothing like RSpec (yet) for Objective-C, but the xUnit-style frameworks SenTest/OCUnit (included with Xcode), Google Toolbox for Mac's unit testing additions to OCUnit and GHUnit are all very good. You can do BDD-style with them as well.

If you're really committed to RSpec, you may want to investigate MacRuby. Although it may feel a little heavy in an Objective-C project, you can load your Objective-C framework(s) and run your unit tests in RSpec via MacRuby.


Here is a post about "string calculator"-kata in Objective-C.

There is UISpec (based on Rspec) for the iPhone and iCuke (based on cucumber)

Autotesting (autoiphonetest.rb) like Paul did in his his blog is interesting.
Another good post: Test Driven Development in Objective-C with MacRuby