This article does not discuss what unit testing is, or the pros and cons of it in a project, and I think unit testing is an effective tool for developers to ensure the quality of output code. This article from the user's point of view to compare the current more popular two unit test framework, to provide you with some suggestions. If you are not quite sure about the role of unit testing in engineering, or the development model of TDD, refer to: Test-driven Development and testing.
This article compares the unit Test framework common to two iOS developments: Ocunit, which is officially integrated into the Xcode 4.x version; Ghunit, the most recommended test framework with GUI interface. The first glimpse of the two test framework is very similar, and hands-on use will find the difference. The details of the difference makes the two frame in different angles of the pros and cons.
Ocunit
Ocunit is the Xcode 4.x integrated Unit test framework, the test in Ocunit is divided into two categories, one is called Logic Tests, the other is called Application Tests. Logic tests prefers the so-called white-box test to test more detailed logic in engineering; application tests prefers black-box testing, or interface testing, for testing interfaces that interact directly with the user.
Adding unit Tests
Ocunit is Xcode integrated, so its integration with the project should be the best, add to the cost of the project should also be the lowest. There is a "Include unit Tests" option in the process of creating a new project using Xcode (Figure 1), and a new project automatically generates a logic Tests.
Adding Ocunit Logic tests to an existing project is also not complicated, just add a target of type: "Cocoa Touch Unit Testing Bundle" (Figure 2).
Figure 2, adding a ocunit test to an existing project