Adding Unit and UI tests to an existing project in Xcode 7

Yes!

You can add new test targets for UI and unit tests by navigating File > New > Target > Test. When that's done, add new test cases by navigating File > New > File > Source.

Test Target


Tests are targets.

Select the project in the navigation view then Menu File > New > Target… and Test of the proper SDK.

Choose UI Testing Bundle or Unit Test Bundle.

Repeat the procedure to add the other test bundle.


One more variant Xcode 10.2.1 using Test Navigator

  1. ⌘ Command + 6 or View -> Navigators -> Show Test Navigator
  2. Right click or + at the bottom
  3. New Unit Test Target... or New UI Test Target...

enter image description here

Tags:

Xcode