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:
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:
- Does it make sense to predefine any symbolic tags in the testing library?
- Would you use any predefined tags if they were present? And
- 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.