What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Xcode.
What is the best way to unit test Objective-C code?
Xcode includes XCTest, which is similar to OCUnit, 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 Xcode Overview: Using Unit Tests.
Back in the Xcode 2 days, I wrote a series of weblog posts about how to perform some common tasks with Xcode unit testing:
- Unit testing Cocoa frameworks
- Debugging Cocoa framework unit tests
- Unit testing Cocoa applications
- Debugging Cocoa application unit tests
Despite using OCUnit rather than XCTest, the concepts are largely the same.
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.
- Trust, but verify.
- Unit testing Cocoa user interfaces: Target-Action
- Unit testing Cocoa user interfaces: Cocoa Bindings
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.
I hope u can use 'SenTestKit', from which u can test each and every method.