[Review] ST-0025 Tag-based test execution filtering

Hello Swift Community!

The review of [ST-0025] "Tag-based test execution filtering" begins now and runs through Friday June 26, 2026. The proposal is available here: swift-evolution/proposals/testing/0025-tag-based-test-execution-filtering.md at main · swiftlang/swift-evolution · GitHub

Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager. When messaging the review manager directly, please keep the proposal link at the top of the message.

Trying it out

To try this feature out, first make sure you're using the nightly Swift toolchain of Release swift-6.4.x-DEVELOPMENT-SNAPSHOT-2026-06-07-a · swiftlang/swift-testing · GitHub or newer, along with the latest Xcode 27 Beta.

Then, add a dependency to the gmedori branch of the swift-testing repo to your project:

...
dependencies: [
  ...
  .package(
    url: "https://github.com/gmedori/swift-testing.git",
    branch: "goose/prefix-based-tag-filtering"
  ),
]

Then, add a target dependency to your test target:

...
.testTarget(
  ...
  dependencies: [
    ...
    .product(name: "Testing", package: "swift-testing"),
  ]
)

What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift and. When writing your review, here are some questions you might want to answer in your review:

  • What is your evaluation of the proposal?
  • Is the problem being addressed significant enough to warrant a change to Swift?
  • Does this proposal fit well with the feel and direction of Swift?
  • If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
  • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

More information about the Swift evolution process is available at swift-evolution/process.md at main · swiftlang/swift-evolution · GitHub

Thank you for contributing to Swift!

Paul LeMarquand
Review Manager

8 Likes

I appreciate all the changes that went in between pitch and this proposal.

I'm in favor of this, it's a sorely needed feature for Swift packages to make SwiftTesting more useful on the CI side.

3 Likes

I completely support this proposal.

Though I have some thoughts/questions/comments.

I tend to create "nest tags". For example, a test is annotated with the following .tags(.TestSize.small)

Could the proposal include an example of how to execute all tests that match this tag?

Also, maybe I missed it, but are regular expressions supported when filtering/skipping on a tag? Would it be possible to update the proposal to explicitly mention this (if it's not already)

2 Likes

Yup we updated the proposal include matching by regular expressions. When matching by regular expressions, it considers the entire symbol name of the tag. So suppose you have a scenario as you describe:

extension Tag {
    enum TestSize {
        @Tag static var small: Tag
        @Tag static var medium: Tag
        @Tag static var large: Tag
    }
}

You could filter on all your small tests just by supplying:

swift test --filter tag:small

This works because we use String.contains to check the regex match, which means it matches anywhere in the string without needing to specify leading or trailing .*. Similarly, if you wanted to match on any tag that uses either .small or .medium test sizes (but not some other small or medium tag), you might write:

swift test --filter 'tag:TestSize\.(small|medium)'

I think this comes across correctly in the latest proposal, and I'd rather keep it concise, but I'm also open to having an Examples section. Let me know if you think this would be useful and help clarify the use cases of the proposal.

2 Likes

This proposal has been accepted! Thanks everyone for participating and leaving your feedback!

2 Likes