Contents

About Unit Testing

Explains how to incorporate test cases to validate individual units of source code.

At a Glance

This document describes how to create products with unit-testing in mind and how to incorporate unit-testing into existing projects.

The content in this document is written for:

Xcode 4.2

iOS SDK 5.0

OS X SDK 10.7

Incorporate Unit-Testing in a Project

To unit-test your code, your project must include unit-test bundles. These bundles contain the test case methods that exercise code in a library or an app to ensure that it behaves correctly.

Chapter: Setting Up Unit-Testing in a Project

Write Test Cases

A test case method calls a unit of code (one or several methods or functions) to ensure that it behaves in the manner expected by the test case, such as returning specific values or throwing an exception. A test case method reports whether the test case passed or failed.

Chapter: Writing Test Case Methods

Run Unit Tests

Run unit tests to ensure that code you’ve just written or modified behaves as expected.

Chapter: Running Unit Tests

Prerequisites

You should be familiar with app design and programming concepts. You should also understand the workflow described in <!--a target="_self" -->App Distribution Guide<!--/a--> .

Next

Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-09-18