Predefined tags in the testing library

Hi folks! We are considering whether or not it makes sense to include a set of predefined symbolic tags in the testing library that are always available without you needing to declare them first.

We recently introduced the @Tag macro to use when defining a symbolic tag:

extension Tag {
  @Tag static var critical: Tag

If there were a set of tags that Swift programmers tended to reach for, and they were all predefined in the testing library, then they could use them without first having to declare them with this syntax, reducing the amount of boilerplate necessary to build a test suite.

(The downside is that not everyone needs a tag named .critical, so for those who don't, it's just extra API surface that will go unused.)

Prior art

Many tagging systems both historical and modern have started users off with a predefined set of labels (a synonym for "tags") that they can use. GitHub provides a list of default labels for all new repositories including "good first issue" and "help wanted". Going further back, Apple's System 7 software included the ability to apply a label to any file, and predefined seven labels:

A screenshot of Mac OS 9's Finder preferences showing the default set of labels.

Hopefully it goes without saying that we don't actually want to ship System 7's labels in swift-testing! They are just examples here. (That said, I did open a PR to build out the infrastructure for predefined tags and used System 7's labels as placeholders.)

For those of you in the audience…

So the questions we're putting to you are:

  1. Does it make sense to predefine any symbolic tags in the testing library?
  2. Would you use any predefined tags if they were present? And
  3. If so, which tags should be predefined so that you can use them?

Remember, tags do not affect any runtime attributes of tests; they are an organizational tool only. In the future, we may augment swift test to include an option such as --filter-by-tag to allow running only those tests with a particular tag.

I’m mostly curious what kind of labels would you include?

‘Severity’ does not make sense to me: a failing test is a failing test.

However perhaps tags about the type of test: such as “unit”, “contract”, “integration”, “e2e” might be helpful?

:+1:t2: for the System 7 reference in prior art.