Adding Test Targets

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

To add test targets
  1. Click the Add button (+) in the test navigator filter bar.

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

  3. Specify the test target options.

    • Product Name: A name for the new test target.

    • Project: The project that contains the new test target.

    • Language: The implementation language, Objective-C or Swift.

    • Target: The target associated with the new test target.

      Xcode configures the new test target to run tests using the associated target, which can be any target contained by the project except a test target.

  4. Click Finish.

    Xcode adds a new target and class to the test navigator, including stub implementations for the setUp, tearDown, testExample, and testPerformanceExample methods.

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