views:

114

answers:

5
+4  Q: 

TDD for an OSX app

Are there any good solutions out there for TDD of a MacOSX Objective-c app?

EDIT: more info

I would really like something similar to rSpec from the Ruby world. Is the XCode built in stuff sufficient? I have heard that it is not. I would like something that supports Mocks, Stubs, and most/all of the test conditions supplied by rSpec (or similar test conditions).

+6  A: 

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.

Seppo Sade
+1  A: 

Personally i use GHUnit, It has a cool little testing app, and supports things like Async test out of the box. Something that in the Delegate heavy world of iPhone & mac programming is invaluable.

Also it's testing methods are named very similar to that of OCUnit, so it you choose either then decide to switch it's fairly easy.

Jonathan
+2  A: 

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.

Barry Wark
+2  A: 

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

Kb