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

[{'answer_id': 33220, 'author': 'Mike Caron', 'author_id': 2836, 'author_profile': 'https://Stackoverflow.com/users/2836', 'pm_score': 4, 'selected': False, 'text': '<p>Check out <a href="http://www.sente.ch/software/ocunit/" rel="nofollow noreferrer">OCUnit</a>. Apple\'s developer network has <a href="http://developer.apple.com/tools/unittest.html" rel="nofollow noreferrer">a great introduction</a>.</p>\n'}, {'answer_id': 33236, 'author': 'Chris Hanson', 'author_id': 714, 'author_profile': 'https://Stackoverflow.com/users/714', 'pm_score': 9, 'selected': True, 'text': '<p>Xcode includes XCTest, which is similar to <a href="http://www.sente.ch/software/ocunit/" rel="noreferrer">OCUnit</a>, an Objective-C unit testing framework, and has full support for running XCTest-based unit tests as part of your project\'s build process.  Xcode\'s unit testing support is described in the <a href="https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/UnitTesting.html" rel="noreferrer">Xcode Overview: Using Unit Tests</a>.</p>\n\n<p>Back in the Xcode 2 days, I wrote a series of weblog posts about how to perform some common tasks with Xcode unit testing:</p>\n\n<ul>\n<li><a href="http://eschatologist.net/blog/?p=18" rel="noreferrer">Unit testing Cocoa frameworks</a></li>\n<li><a href="http://eschatologist.net/blog/?p=20" rel="noreferrer">Debugging Cocoa framework unit tests</a></li>\n<li><a href="http://eschatologist.net/blog/?p=24" rel="noreferrer">Unit testing Cocoa applications</a></li>\n<li><a href="http://eschatologist.net/blog/?p=26" rel="noreferrer">Debugging Cocoa application unit tests</a></li>\n</ul>\n\n<p>Despite using OCUnit rather than XCTest, the concepts are largely the same.</p>\n\n<p>Finally, I also wrote 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.</p>\n\n<ul>\n<li><a href="http://eschatologist.net/blog/?p=16" rel="noreferrer">Trust, but verify.</a></li>\n<li><a href="http://eschatologist.net/blog/?p=10" rel="noreferrer">Unit testing Cocoa user interfaces: Target-Action</a></li>\n<li><a href="http://eschatologist.net/blog/?p=12" rel="noreferrer">Unit testing Cocoa user interfaces: Cocoa Bindings</a></li>\n</ul>\n\n<p>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.</p>\n'}, {'answer_id': 302603, 'author': 'Ryan Townshend', 'author_id': 24707, 'author_profile': 'https://Stackoverflow.com/users/24707', 'pm_score': 4, 'selected': False, 'text': '<p>I started using the Google toolbox testing rig for iPhone, and its working out great for me.</p>\n\n<p><a href="http://code.google.com/p/google-toolbox-for-mac/" rel="noreferrer">google-toolbox-for-mac</a></p>\n'}, {'answer_id': 455320, 'author': 'nst', 'author_id': 55137, 'author_profile': 'https://Stackoverflow.com/users/55137', 'pm_score': 3, 'selected': False, 'text': '<p>Sen:te (the creator of the testing framework included with Xcode) explains how to use OCUnit with an iPhone project: <a href="http://www.sente.ch/s/?p=535&amp;lang=en" rel="nofollow noreferrer">simple-iphone-ipad-unit-test</a>. </p>\n'}, {'answer_id': 586060, 'author': 'elasticrat', 'author_id': 54576, 'author_profile': 'https://Stackoverflow.com/users/54576', 'pm_score': 6, 'selected': False, 'text': '<p>Check out <a href="http://github.com/gabriel/gh-unit/tree/master" rel="noreferrer">GHUnit</a> by Gabriel Handford:</p>\n\n<blockquote>\n  <p>"The goals of GHUnit are:</p>\n  \n  <p>Runs unit tests within XCode, allowing\n  you to fully utilize the XCode\n  Debugger. A simple GUI to help you\n  visualize your tests. Show stack\n  traces. Be installable as a framework\n  (for Cocoa apps) with a simple (or\n  not) target setup; or easy to package\n  into your iPhone project."</p>\n</blockquote>\n'}, {'answer_id': 603550, 'author': 'clint', 'author_id': 62694, 'author_profile': 'https://Stackoverflow.com/users/62694', 'pm_score': 4, 'selected': False, 'text': '<p>Note that the Google Toolbox for Mac (GTM) project simply extends/augments Apple\'s SenTestingKit framework (which is, itself based on OCUnit). As they say on the project site:</p>\n\n<blockquote>\n  <p>GTM has several enhancement to the\n  standard SenTestingKit allowing you to\n  do UI unit testing, automated binding\n  unit testing, log tracking, and unit\n  testing on the iPhone, as well as\n  tools for doing static and dynamic\n  testing of your code.</p>\n</blockquote>\n\n<p>Note the following comment about user-interface testing:</p>\n\n<blockquote>\n  <p>GTM has extensive support for user\n  interface unit tests. It supports\n  testing both the imaging and/or\n  internal state of almost all of the\n  standard Cocoa/UIKit UI objects, and \n  makes it easy for you to extend this \n  support to your own UI objects.</p>\n</blockquote>\n\n<p>See their "<a href="http://code.google.com/p/google-toolbox-for-mac/wiki/CodeVerificationAndUnitTesting" rel="noreferrer">Code Verification and Unit Testing</a>" page for instructions on how to use it.</p>\n'}, {'answer_id': 646802, 'author': 'Nikita Zhuk', 'author_id': 32045, 'author_profile': 'https://Stackoverflow.com/users/32045', 'pm_score': 3, 'selected': False, 'text': '<p>I would also recommend using coverage tools to see which part of the code are covered with unit tests and which are not. Basic line and branch code coverage can be generated with the <a href="http://developer.apple.com/qa/qa2007/qa1514.html" rel="noreferrer">GCOV</a> tool. If you want to generate nice HTML coverage reports there are <a href="http://ltp.sourceforge.net/coverage/lcov.php" rel="noreferrer">LCOV</a> and <a href="http://checking.stanford.edu/wiki/Klee" rel="noreferrer">ZCOV</a> which do just that.</p>\n'}, {'answer_id': 646813, 'author': 'Joel Levin', 'author_id': 55743, 'author_profile': 'https://Stackoverflow.com/users/55743', 'pm_score': 3, 'selected': False, 'text': '<p>I recommend gh-unit, it has a nice GUI for test results.</p>\n\n<p><a href="http://github.com/gabriel/gh-unit/tree/master" rel="noreferrer">http://github.com/gabriel/gh-unit/tree/master</a></p>\n'}, {'answer_id': 1618605, 'author': 'Johannes Rudolph', 'author_id': 125407, 'author_profile': 'https://Stackoverflow.com/users/125407', 'pm_score': 4, 'selected': False, 'text': '<p>I came to the conclusion that GHUnit is the most advanced testing framework for Objective-C. I have done a <a href="http://jorudolph.wordpress.com/2009/10/10/the-lack-of-a-proper-iphone-unittest-framework/" rel="noreferrer">roundup</a> of testing frameworks on my blog. It is the most flexible in terms of deployment (iphone, simulator or mac os native) and assert capabilities. Because it is based on GTM, it inherits all of GTM\'s advantages over SenTestingKit but also adds a lot more. Another bonus is that it is being maintained very actively.</p>\n\n<p>I have conducted effort to integrate <a href="http://www.mulle-kybernetik.com/software/OCMock/" rel="noreferrer">OCMock</a> into GHUnit, it works great!. You can get the code on <a href="http://github.com/JohannesRudolph/gh-unit" rel="noreferrer">github</a>.</p>\n'}, {'answer_id': 1954585, 'author': 'Mihir Mathuria', 'author_id': 224440, 'author_profile': 'https://Stackoverflow.com/users/224440', 'pm_score': 3, 'selected': False, 'text': '<p>Matt Gallagher of Cocoa with Love has a <a href="http://cocoawithlove.com/2009/12/sample-mac-application-with-complete.html" rel="noreferrer">very good article</a> on unit testing.</p>\n'}, {'answer_id': 2861982, 'author': 'C. Bess', 'author_id': 344591, 'author_profile': 'https://Stackoverflow.com/users/344591', 'pm_score': 2, 'selected': False, 'text': '<p>I use SimpleUnitTest works with iPhone and iPad libs.</p>\n\n<p><a href="http://cbess.blogspot.com/2010/05/simple-iphone-ipad-unit-test.html" rel="nofollow noreferrer">http://cbess.blogspot.com/2010/05/simple-iphone-ipad-unit-test.html</a></p>\n\n<p>It comes with a unit test Xcode template to easily add a unit test class. Wraps GTM.</p>\n\n<p>You can literally drop it into an active project and start adding unit tests within 3 minutes (or less).</p>\n'}, {'answer_id': 3446408, 'author': 'Steph Thirion', 'author_id': 36182, 'author_profile': 'https://Stackoverflow.com/users/36182', 'pm_score': 3, 'selected': False, 'text': '<p>The <a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/UnitTesting/1-Articles/CreatingTests.html" rel="nofollow noreferrer">Unit Testing support bundled within xcode</a> (for its simple setup) combined with <a href="http://github.com/jim/ocrunner" rel="nofollow noreferrer">ocrunner</a> (for some autotest/Growl goodness) is currently my favorite Obj-C Unit Testing setup.</p>\n'}, {'answer_id': 4253695, 'author': 'Adam Milligan', 'author_id': 499384, 'author_profile': 'https://Stackoverflow.com/users/499384', 'pm_score': 4, 'selected': False, 'text': '<p>I realize this is an old question, but if you prefer BDD-style testing (rspec, Jasmine, etc.) over xUnit-style testing (Test::Unit, JSUnit, JUnit, etc.), then you may consider checking out <a href="http://github.com/pivotal/Cedar">Cedar</a>. Cedar brings BDD-style testing to Objective-C, now that the language supports closures.</p>\n\n<p>We\'re happily using Cedar for our iOS projects at <a href="http://pivotallabs.com">Pivotal Labs</a>, and we\'re actively working on improving it. Any feedback or suggestions are welcome at cedar-discuss@googlegroups.com</p>\n'}, {'answer_id': 5785659, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>here is a whole lot of them</p>\n\n<p><a href="http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#Objective-C" rel="nofollow noreferrer">List_of_unit_testing_frameworks in Objective-C</a></p>\n'}, {'answer_id': 15046957, 'author': 'Krzysztof Grzywacz', 'author_id': 2103385, 'author_profile': 'https://Stackoverflow.com/users/2103385', 'pm_score': 3, 'selected': False, 'text': '<p>I would suggest looking into Kiwi, an open source BDD testing framework for iOS:\n<a href="https://github.com/allending/Kiwi" rel="nofollow">Kiwi</a></p>\n\n<p>Check out the project\'s WIKI to start or get Daniel Steinberg\'s book "Test Driving iOS Development with Kiwi"\n<a href="https://itunes.apple.com/us/book/test-driving-ios-development/id502345143?mt=11" rel="nofollow">test-driving-ios-development</a></p>\n'}, {'answer_id': 17110023, 'author': 'Karthik', 'author_id': 1606600, 'author_profile': 'https://Stackoverflow.com/users/1606600', 'pm_score': 0, 'selected': False, 'text': "<p>I hope u can use 'SenTestKit', from which u can test each and every method. </p>\n"}, {'answer_id': 22426189, 'author': 'dbainbridge', 'author_id': 1394755, 'author_profile': 'https://Stackoverflow.com/users/1394755', 'pm_score': 2, 'selected': False, 'text': '<p><a href="https://github.com/specta/specta" rel="nofollow">Specta</a> is a modern TDD(Test Driven Development)/BDD(Behavior Driven Development) framework which runs on top of XCTest.  It supports unit testing for iOS and Mac OS X projects.  </p>\n'}]
['https://Stackoverflow.com/questions/33207', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2339/']