iPhone Unit Testing

A brief history

1998. OCunit is written by Sen:te in March from Kent Beck’s description of the Smalltalk frameworkand Objective C becomes one of the first language to benefit from this approach to testing. The framework is published in May. In November Project Builder (an ancestor of Xcode) integration is total: tests are discovered and executed automatically when the project is compiled, and errors appear in the Build console.

2002. OCUnit is presented at WWDC in the Stepwise birds of feather meeting.

2005. Apple decides to integrate unit testing in Xcode 2.1, and choose OCUnit.

2008. OCUnit is integrated by Apple in iPhone SDK 2.2, but not totally adapted to the particularities of the environment. The Google Toolbox for Mac unit testing is based on OCUnit’s SenTestingKit.

2009. Unit testing in an iPhone project is now as straightforward as it should be and very well documented by Apple in the iPhone Reference Library.

Add tests to the iPhone simulator

The 3.0 release of the SDK made the explanations found here obsolete.

Exemple

Apple gives a full example: the automated test of a calculator.

Presentation

The slides of a presentation made to the développeurs iPhone de Suisse Romande on January 28, 2009 are available (French, PDF).