Can I run an XCTest suite multiple times?

automated-tests, testing, unit-testing, xcode, xctest

Solution

Xcode has a built-in way you can do this:

Right-click the test and select `Run <test> Repeatedly...`

That menu has a few configurations, one of them is `Stop After` where you can select `Failure` which will stop the execution if it failed during one of the repetitions.

You can also run a test class or the whole test suite repeatedly.

Problem

Is it possible to have Xcode run your unit tests multiple times? I had an issue in several unit tests that caused intermittent failures. Now that I think I've fixed it, my only option appears to mash ⌘ + U until I'm 95% confident the bug is gone. I know other unit testing frameworks make it quite easy to run a single test, test case, or test suite multiple times. Do we have this luxury in XCTest yet?

Original source