I'm pretty sure it's working properly....

The frontmost thought in every code monkeys mind when it's time to ship.

So what can we do to move from "I'm sure" to "I know"?

It's fine to have a test plan and a group of beta testers to put each release through its paces but how can you know that all the bugs have been squashed and no old ones have returned?

An answer to this conundrum comes in the form of Unit Testing, the basic idea is to have a separate application that uses the libraries and objects from the target application to test the functionality of that application. 

Typically the test application is run as part of the build system and gives instant feedback to the developer on the state of the tests, this way, when a code change is made you can be sure that the tested functionality is correct and no new or old bugs have crept in during the change.

Unit testing, rather than providing a complete solution to the problem is a foundation on which more powerful methods can be built.

There are two commonly used techniques built on top of (or used in combination with) Unit Testing that are worth exploring further, they are :-

 

TDD is a form of Agile development in which the developer performs a series of iterations in which a modification or new feature begins life as a small series of tests that exercise the required functionality (this will initially fail as the code has not yet been written), code that satisfies the test is then written and on each successive iteration the code is refined and developed first with tests and later in code. The advantage of this method is in forcing the developer to break the problem into bite sized pieces and think clearly about the functionality of each bite in isolation. The resulting code tends to be clean, concise and coupling between pieces is kept to a minimum.

CI often involves the use of a build server that periodically takes the current source tree for an application and performs a build and test cycle, the results of the tests are then typically sent to all the developers. Current best practice recommends checking changes into source control frequently (often multiple times per day) in order to prevent "Integration Hell" that comes from trying to merge multiple changes from many developers all at once. It is not uncommon for the CI process to be performed on every code checkin.

In the iOS (and larger Objective-C) world Unit Testing support is available in Xcode through the open source SenTestingKit framework, there are also third party frameworks like OCMock and Frank

Some interesting articles on TDD & Unit Testing