I just decided on Kiwi for a project rather than OCMock + OCUnit. These are Kiwi’s selling points for me:
- Stubbing class methods is simpler. With OCMock, I needed to create a special class (one per project) to do method swizzling. No such problem with Kiwi – just
[MyClass stub:@selector(doFoo) andReturn:myBar];
- Mock failures with Kiwi show up on the line that failed in Xcode (they showed up in strange places with OCMock).
- Kiwi’s test failures produce descriptive, unambiguous error messages (as opposed to the not-so-helpful messages from OCMock & OCUnit).
mock, and other readable methods (rather than
STAssertEqualObjectsand other not-so-easy-to-read macros & methods). Check out the Expectations page and the Mocks and Stubs page to decide for yourself.
- No need to
[mock verify], which is required with OCMock.
Go ahead and give Kiwi a try. I think you’ll like it.
Test Driving iOS Development with Kiwi by Daniel Steinberg is an excellent book on the topic.
Getting Started with Kiwi 2.0 will walk you through the setup process.
Or you can read the official documentation.