I am trying to get OCUnit to do anything on my project, but I am failing :-( Is there any good tutorial out there to get it work? Everything I find tells something different and they are all pretty complicated ...
What I tried is e.g.
code:
#import <SenTestingKit/SenTestingKit.h>
@interface XTest : SenTestCase {
}
@end
@implementation XTest
- (void)testAuthentication {
STFail(@"fail");
}
@end
The result is, a build success ... What do I have to do to get unit testing working ?
I demonstrate the setup of unit tests, along with the new UI Automation interface testing instrument, in the video for the "Testing" class session in my iPhone development class on iTunes U. The video for the "Unit testing" session from last semester's class also delves into this in detail.
My course notes for unit testing from last semesters session can be found here. I created a small sample application illustrating the use of unit tests, with the source code available for download from here.
I also highly recommend Graham Lee's course on test-driven development for Cocoa on iDeveloper.tv. You do have to pay for those videos, but they are well worth the cost for the quality of the material presented there. I picked up a lot of techniques from watching them.
This question has been asked before: What is the best way to unit test Objective-C code?
All of the information you need can be found here: http://developer.apple.com/tools/unittest.html
Google provides a library of useful code for iPhone developers which also includes an alternative testing framework. Some like it better than the OCUnit that is included with Xcode: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With