Skip to content

Support when clauses for test configurations. #1627

@ReubenFrankel

Description

@ReubenFrankel

Is there a way to control what configurations are available to select when running tests in a specific package, class or method? I am aware there is a filters property, but as far as I can see this only supports JUnit tags (filters.tags) at the moment. I want to be able to filter by patterns (inspired by the Maven Surefire Plugin) - something like this:

settings.json

{
    "java.test.config": [
        {
            "name": "tests in specific package"
            "filters": {
                "pattern": "com.example.test"
            }
        },
        {
            "name": "tests not in specific package"
            "filters": {
                "pattern": "!com.example.test"
            }
        },
        {
            "name": "tests in specific class"
            "filters": {
                "pattern": "com.example.test.ExampleTests"
            }
        },
        {
            "name": "tests not in specific class"
            "filters": {
                "pattern": "!com.example.test.ExampleTests"
            }
        },
        {
            "name": "tests in a class of this name"
            "filters": {
                "pattern": "testExample"
            }
        },
        {
            "name": "not tests in a class of this name"
            "filters": {
                "pattern": "!ExampleTests"
            }
        },
        {
            "name": "this specific test"
            "filters": {
                "pattern": "com.example.test.ExampleTests#testExample"
            }
        },
        {
            "name": "not this specific test"
            "filters": {
                "pattern": "!com.example.test.ExampleTests#testExample"
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions