views:

126

answers:

4

Does anyone know of any xUnit testing frameworks for the Mac OS, more specifically for the iPhone OS? I've seen a couple online, google-toolbox-for-mac & objcUnit, but they don't seem to have had any development on them for a long time.

Are there any Objective-C developers out there that perform unit testing and if you do what tools do you use?

+1  A: 

UnitTest++ is a very light weight, but powerful unit testing framework that I like a lot. It's site is: http://unittest-cpp.sourceforge.net/.

I've written a blog article about integrating it into an iPhone development environment, for more information you can see here: http://acornheroes.com/?p=152

Hope this helps.

George Sealy
+2  A: 
  • gh-unit is a great framework and is actively maintained. it has a GUI.
  • ocunit is bundled with Xcode.
  • XcodeUnitTestGUI which is fairly immature, but works and provides a GUI for ocunit based tests (disclaimer -- this is my project).
nall
+2  A: 

OCUnit (shipped with Xcode) is a full xUnit-style testing framework that is integrated with Xcode (failures show up as linked build errors) and works on the iPhone and OS X. The Google Toolbox for Mac provides additional functionality (including UI testing and gcov support) on top of OCUnit. I'm not sure where you got the idea that it's not under active development. The last change was only 4 days ago (at the time of this post). For a mock framework, check out OCMock, an OCUnit-integrated mocking library (you may find that Objective-C's dynamic nature makes unit testing in general and mocking in particular much easier than expected by those accustomed to C/C++/C#/Java).

Believe it or not, Objective-C developers do do unit testing.

Barry Wark
I never saw ocUnit, it didn't show up in my search. The names that I listed don't seem to be under development, most recent change was in 2008.
Keith Moore
As for the unit testing I reckon the majority of developers, using *any* language, don't do unit testing of any kind. Certainly wasn't having a go at Ocbject-C devs.
Keith Moore
True, true. No offense taken ;)
Barry Wark
+1  A: 

I agree that OCUnit is a great xUnit tool. Integration with Xcode is solid, and it works well with OCMock. It's also hard to overstate the value of Apple being committed to the code — there is certainly room for improvement, but it's solid and still maintained. Xcode also integrates pretty nicely with gcov, a GNU tool for instrumenting code coverage. A few links...

To back up Barry, yes, lots of Objective-C developers do unit testing, including inside Apple. (Just ask @bbum about CoreData unit tests...) For examples of what you can do, feel free to raid my side project:

Quinn Taylor