Adding Test Classes

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

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

    ../Art/tnh-addtestclss-1_2x.png
  2. From the pop-up menu, choose New Test Class.

    ../Art/tnh-addtestclss-2_2x.png
  3. Choose the Test Case Class template, and click Next.

    ../Art/tnh-addtestclss-3_2x.png
  4. Enter a name for the class, choose the superclass and implementation language, and click Next.

    ../Art/tnh-addtestclss-4_2x.png
  5. Select a destination, group, and target, and click Create.

    ../Art/tnh-addtestclss-5_2x.png

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

    ../Art/tnh-addtestclss-6_2x.png
  6. Complete the stub implementations, and add other code as necessary.