I’m excited to announce a new open source project exploring improvements to the testing experience for Swift. My colleagues @briancroom, @grynspan, @chefski, @Dennis and I have been working on this in recent months and have some early progress we’re excited to share.

Inspired by what’s possible with Swift macros, we’ve built a testing library API that can:

Provide granular details about individual tests using an attached macro named @Test. This enables many new features like expressing requirements, passing arguments, or adding custom tags, all directly in code instead of separate configuration files. Validate expected conditions in tests with detailed and actionable failure information using an expression macro spelled #expect(…). This works by capturing the values of passed-in expressions and their source code automatically to inform failure messages, and is also easier to learn than specialized assertion functions since it accepts built-in operator expressions like #expect(a == b). Easily repeat a test multiple times with different inputs by adding a parameter to the function and specifying its arguments in the @Test attribute.