ProAnswers.org

Best way to unit test Objective-C code?

What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Xcode.

Xcode includes [Xcode Unit Testing Guide](http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTesting/UnitTesting.html).



I've written [a series of weblog posts](http://chanson.livejournal.com/119097.html) about how to perform some common tasks with Xcode unit testing:




	[Unit testing Cocoa frameworks](http://chanson.livejournal.com/119303.html)

	[Debugging Cocoa framework unit tests](http://chanson.livejournal.com/119578.html)

	[Unit testing Cocoa applications](http://chanson.livejournal.com/120263.html)

	[Debugging Cocoa application unit tests](http://chanson.livejournal.com/120740.html)


Finally, I've written a few posts on how to write tests for Cocoa user interfaces; the way Cocoa is structured makes it relatively straightforward, because you don't have to spin an event loop or anything like that in most cases.




	[Trust, but verify.](http://chanson.livejournal.com/118380.html)

	[Unit testing Cocoa user interfaces: Target-Action](http://chanson.livejournal.com/148204.html)

	[Unit testing Cocoa user interfaces: Cocoa Bindings](http://chanson.livejournal.com/172390.html)


This makes it possible to do test-driven development for not just your model-level code but also your controller-level and even view-level code.