Adding Test Targets

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

bullet
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.

    ../Art/new_test_target_2x.png
  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.

      ../Art/new_test_target_options_2x.png
  4. Click Finish.

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

    ../Art/new_test_target_created_2x.png
  5. Complete the stub implementations, and add other code as necessary.