Running Unit Tests

To ensure that changes you make to your code don’t alter its correct behavior, you should run your test suites periodically, especially after making significant changes. This chapter explains how to run unit tests.

You run unit tests by executing the Test command on a scheme whose Test action identifies one or more unit-test targets.

To run unit tests:

  1. From the Scheme toolbar menu, choose the scheme that incorporates the unit-test targets you want to use in its Test action (see Configuring a Scheme to Run Unit Tests), and the run destination.

  2. Choose Product > Test.

    If one or more tests cases fail, they are listed in the issue navigator (View > Navigators > Show Issue Navigator).

  3. To view the transcript of your unit-test run, choose View > Navigators > Show Log Navigator, and select the first test action listed in the log navigator.

    The log viewer shows the log of the unit-test run, as shown in Figure 5-1.

    Figure 5-1  Log of an application unit-test run