vscode-java-test icon indicating copy to clipboard operation
vscode-java-test copied to clipboard

Feature Req: Support filtering tests by JUnit 5 tags

Open Skynet0 opened this issue 4 years ago • 2 comments

https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions

A lot of our existing tests are identified by tags, in addition to being in different files. As far as I'm aware, there's no way to run all tests in a workspace that match a tag expression. I would like to be able to create and run test configurations that filter tests based on tags.

Skynet0 avatar Nov 05 '20 02:11 Skynet0

To enable the tags filter, you need to add following sections into your java.test.configuration:

"testKind": "junit",
"filters": {
    "tags": [
        "foo",    // ---> include tag 'foo'
        "!bar"    // ---> exclude tag 'bar'
    ]
}

Endgame note:

To verify the feature, https://github.com/microsoft/vscode-java-test/blob/main/test/test-projects/junit/src/test/java/junit5/tags/TagTest.java can be used.

jdneo avatar Aug 29 '22 06:08 jdneo