What's New in Testing - Swift 6.2/Xcode 26

Nice addition! Regarding this point you mentioned in the post:

One thing I would like to have the ability to do is to configure how Runtime Issue are reported for a specific test. I can see wanting to leave this set to warning, except for specific tests which check that a runtime issue has been resolved. For those tests, you would want runtime issues (or at least, the specific runtime issue the test is checking) to cause test failures. Perhaps this will be something you can do with Issue Handling Traits in Swift Testing, though I’d also like to see an option to do the same in XCTest (feel free to duplicate FB18523387).

You can do this currently by overriding the recordIssue(_:) method from XCTestCase and modifying the severity property of the passed-in XCTIssue from .warning to .error before passing the modified issue to super.recordIssue(…). You could do that conditionally, based on the content of an issue, or only scoped to particular test methods in that class—whatever makes sense for your situation.

Conceptually, that technique in XCTest is similar to what my Issue Handling Traits proposal seeks to begin supporting in Swift Testing.

1 Like