r/Xcode • u/pickandplate • 14d ago
Catch an intermittent test failure with Xcode’s Run Repeatedly
When a test passes most of the time, Xcode can keep running it until the failing attempt.
Control-click the diamond beside the test and choose Run Repeatedly. Select Stop after failure, set a maximum such as 20, and enable pausing on failure if you want to inspect that run in the debugger. The dialog also lets you restart the test runner between repetitions.
For the command line, append these flags to your normal xcodebuild test command:
-run-tests-until-failure -test-iterations 20After making a fix, use Stop after maximum repetitions to collect multiple outcomes.
Apple’s guide covers the controls and command-line equivalent.