How to exclude test classes using pattern in VS Code Java Test Runner

Viewed 219

I just started trying to use VS Code for Java.

One of my Java project has both Unit Tests and Integration Tests. I'd like to run them separately. So as mentioned in Java Test Runner doc, I added a test configuration in my settings.json:

    "java.test.config": [
        {
            "name": "unit",
            "workingDirectory": "${workspaceFolder}",
            "args": [ "-N", ".*IT$" ],
            "vmargs": [ "-Xmx512M" ],
        },
    ],

I'm trying to exclude all integration test classes matching pattern .*IT$. According to JUnit5 doc:

-N, --exclude-classname=PATTERN Provide a regular expression to exclude those classes whose fully qualified names match. When this option is repeated, all patterns will be combined using OR semantics.

However, it doesn't work. It still runs all tests (including both unit and integration tests).

In Intellj IDEA, it's very easy to only include test classes matching a regex pattern. Is there a feature in Java Test Runner?

0 Answers
Related