Starting from Xcode 12.4 (I think), failing unit tests in framework targets take about 5 seconds to complete. Successful tests complete almost instantly (as expected).
For example, the following test:
func testExampleFailure() {
XCTFail()
}
Takes 4.356 seconds to execute on my 2019 MacBook Pro:
Test Case '-[FrameworkTests.FrameworkTests testExampleFailure]' failed (4.356 seconds).
This seems to only affect unit tests in Framework targets (unit tests for App targets are unaffected). I have also tested this in fresh Framework template projects across multiple Macs, so it appears to be an Xcode bug.
I'd hoped Xcode 13 would fix this issue, but it persists for me on Monterey. Perhaps someone could suggest a workaround?
I'm seeing the same behavior. It's a big hit to productivity, and of course it discourages running the test suite. Have you had any luck figuring this out?
No luck - it still occurs in Version 13.3.1. I reported this to Apple last October (FB9726940).
It also appears to affect Swift Package targets, and even occurs in Xcode Cloud test failures.
The one interesting thing is that it only occurs if you set My Mac or My Mac Catalyst as the run destintation (which is obviously the default for a framework that only imports Foundation). If you choose an iOS simulator, the problem is resolved.
Clearing the system log as discussed in the thread Quinn “The Eskimo!” linked to has no effect on the problem.
Exact same issue - Swift Package with Mac as run destination takes ~5s complete a failing test with only a single XCTFail() statement in the whole test. Switching to iOS fixes the issue.