Adding Test Targets

Expand the scope of your unit testing by adding test targets to a project.

To add test targets
  1. In the lower-left corner of the test navigator, click the Add button.

  2. In the pop-up menu, choose New Test Target.

  3. Specify the following test target options:

    • Product Name: Enter a name for the target.

    • Type: Choose XCTest to use the XCTest framework that’s new in XCode 5, or OCUnit to use the legacy testing framework.

    • Project: Choose the project to add the test target to.

    • Target: Choose the target to associate the test target with.

      Xcode configures the new test target to test the target that you choose from the Target pop-up menu.

  4. Click Finish.

    A new target and class are added to the test navigator, including stub implementations for the setUp, tearDown, and testExample methods.

  5. Complete the stub implementations, and add other code as necessary.