Mac OS X Reference Library Apple Developer
Search

Introduction

It is a familiar scenario to many developers. Major development is complete. The application has been tested. The team is fairly confident about the stability of the code. Then someone introduces that one last feature that breaks several seemingly unrelated features. Somehow, the new code has changed a fundamental assumption about the behavior of a code module and that change has now broken other modules. How do you validate your code in a way that will prevent this scenario from happening again? One way is through unit testing.

By adding appropriate unit tests to your projects, each engineer can verify that newly introduced code does not break any existing behavior. A unit test is simply a piece of code that exercises some part of your application. The unit test provides a specific input and expects your code to return a specific output. If your code returns an unexpected value, the unit test reports the discrepancy.

Third-party unit testing modules have been available for Xcode for some time. In addition, Xcode 2.1 now integrates some modules directly into the project environment. These modules provide the basic testing harness needed to build automated and repeatable test suites. This document shows you how to incorporate unit tests into your Xcode projects and also offers tips and guidance on how to get the most out of your tests in Mac OS X.

Organization of This Document

This document includes the following article:




Last updated: 2009-10-19

Did this document help you? Yes It's good, but... Not helpful...