Search code examples
xcodeunit-testingxcode4dependencies

How do I automatically perform unit tests on each build?


How do I automatically perform unit tests on each build?

I tried to add the Unit Tests target to the Project Target as a dependency, but that doesn't seem to run the actual tests.


Solution

  • Set the Test After Build build setting to Yes. Choose Product > Build For > Build For Testing to build the project and run the tests.

    Xcode 5 Update

    Xcode 5 does not support the Test After Build build setting. I don't know of any way to automatically run tests on each build in Xcode 5. From the OS X menu bar choose Product > Test or press Command + u to run unit tests in Xcode 5.