How to add Unit Test to your existing Xcode project

There are 2 checkboxes at the very beginning of the new project wizard, Include Unit Tests and Include UI Tests. You can use this guide to re-add those tests, if you removed the mark from the boxes during the new project creation process.

If you forgot to include Unit test in your project, first you need to add a Build target. Based on the Apple’s best practice, it is advised to have a separate build target for Unit and UI tests.

Click on the project, and then on the General settings you should see the Targets, and the + sign at the bottom left corner you can go through the wizard where you should add a Unit Testing Bundle.

If you accept the default settings you will end up a same configuration, like you have left the aforementioned select box checked.

AddingNewTestingTarget


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.