Add a test target to a project

Add a test target to expand the scope of testing in a project.

  1. Click the Add button (+) at the bottom of the Test navigator.

  2. Choose New UI Test Target or New Unit Test Target from the pop-up menu.

  3. Enter a name for the target in the Project Name field.

  4. Choose an implementation language from the Language pop-up menu.

  5. If your workspace includes multiple projects, choose a project from the Project pop-up menu. The test target will be created in the project you specify here.

  6. Choose a target to run tests on from the “Target to be Tested” pop-up menu. This can be any target contained by the project except a test target.

  7. Configure any additional options, such as your team, organization name, and bundle identifier.

  8. Click the Finish button.

    A new test target with a new class is added to the project and appears in the Test navigator. The new class contains templates for setUp, tearDown, testExample, and testPerformanceExample methods.

  9. Select the new class in the navigator and enter the test code in the source editor.

See alsoRun UI tests and unit testsAdd a test class to a project