What is a good tutorial to start testing iPhone using OCUnit?

I am trying to get OCUnit to do something in my project, but I am failing :-( Is there a good tutorial to get it to work? Everything I find speaks for something else and they are all quite complicated ...

What I tried, for example,

  • set up a test object.
  • add my goal as addiction
  • add xxTest.m to my target and write a test file, for example:

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 need to do to work with unit testing?

+4
source share
2 answers

I demonstrate how to set up unit tests along with a new UI Automation interface testing tool in a video for a test session in my iPhone development class on iTunes U. The video for the Unit Test session from the last semester class also understands this in detail.

My unit notes from last semester can be found here . I created a small sample application illustrating the use of unit tests, with the source code available for download here .

I also highly recommend Graham Lee's test- based development course for Cocoa on iDeveloper.tv. You have to pay for these videos, but they are worth it, for the quality of the material presented there. I gathered a lot of techniques, watching them.

+9
source

This question has been asked before: What is the best way to unit test Objective-C code?

All relevant information is 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. For some, this is better than OCUnit, which is included in Xcode: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting

+1
source

All Articles