I propose introducing a new API to Swift Testing that allows developers to record issues with a specified severity level. By default, all issues will have severity level “error”, and a new "warning" level will be added to represent less severe issues. The effects of the warning recorded on a test will not cause a failure but will be included in the test results for inspection after the run is complete.
To see my draft proposal, click https://github.com/suzannaratcliff/swift-evolution/blob/suzannaratcliff/issue-severity-warnings/proposals/testing/XXXX-issue-severity-warning.md!
Trying it out
To try this feature out, add a dependency to the main branch of swift-testing to your project:
...
dependencies: [
.package(url: "https://github.com/swiftlang/swift-testing.git", branch: "main"),
],
...
and to your test target:
.testTarget(...
...,
dependencies: [
...,
.product(name: "Testing", package: "swift-testing")
]
Next, import Swift Testing using @_spi(Experimental)
So, instead of import Testing, use @_spi(Experimental) import Testing
instead.
To record a warning issue:
Issue.record("My comment", severity: .warning)