swift-testing icon indicating copy to clipboard operation
swift-testing copied to clipboard

Request for the ability to run tests in a Package with a given tag from the command line

Open dimsumthinking opened this issue 1 year ago • 5 comments

Description

When running tests for a package from the command-line using swift test I'd love a flag that allows me to run the tests for a given tag.

It would also be nice to be able to write more complicated predicates so that I could run them for:

tag1. (just those whose tags include tag1) ~tag1 or !tag1 (all items who's tags do not include tag1) no-tags (any untagged item) tag1 & tag2 (must be tagged with both) tag1 | tag2 (must be tagged with either)

Sorry if this is too vague - but I had to give up on the command line at the point that I just wanted to run tests for a given tag.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

swift-testing version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

dimsumthinking avatar Aug 01 '24 15:08 dimsumthinking

It wouldn't be impossible to amend the existing --filter and --skip arguments to take tags so long as they're syntactically distinguishable from regular expressions representing (potentially partial) test IDs.

For instance, if we required a prefix tag:, that would not represent a valid test ID as no test ID should start with that prefix:

swift test --filter tag:critical

(This would also serve to automagically filter out all XCTest tests as no XCTest test ID can start with that string either.)

It wouldn't give us full boolean logic on tags, but building out what is effectively a parser/lexer just for parsing tags may be overkill.

grynspan avatar Aug 02 '24 12:08 grynspan

Thank you

using filter or skip the way you describe would certainly meet my needs.

dimsumthinking avatar Aug 02 '24 15:08 dimsumthinking

Tracked internally by rdar://132989780.

grynspan avatar Aug 13 '24 14:08 grynspan

How has this been going?

dl-alexandre avatar Feb 07 '25 01:02 dl-alexandre

Tracked internally as rdar://132989780.

grynspan avatar Mar 12 '25 18:03 grynspan