You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VS Code reports test status incorrectly when classname ends with IT #381
When using Maven, it is common to use *IT.java as the test class name to show it is an integration test. (vs an unit test). The failsafe plugin recommends this convention.
I wrote a very simple JUnit 5 integration tests class with one passing test and one failing test. In the Java editor, VS Code correctly shows a green check for the "good" test and a red check for the "bad" test. However, it shows both tests as skipped in the test reports list. It also shows zero tests as run on the bottom of the screen.
VS Code does behave properly if I rename my test from JeanneIT to JeanneTest. The test results and bottom bar both acknowledge the tests were run.
Note. When I saw another issue (#344) had a problem with the Maven plugin, I tried disabling that plugin. It solved #344 but not this one (#381). Mentioning so nobody wastes time going down that alley.
Activity
boyarsky commentedon Nov 4, 2018
Note. When I saw another issue (#344) had a problem with the Maven plugin, I tried disabling that plugin. It solved #344 but not this one (#381). Mentioning so nobody wastes time going down that alley.
jdneo commentedon Jun 17, 2019
Hi Jeanne (@boyarsky), is the problem still occur by using the newest version of Test Runner?
If yes, would you mind to provide a sample project with us to repro the issue?
boyarsky commentedon Jun 17, 2019
It actually got worse. Now when I click "run test" on JeanneIT, it doesn't show anything in the report or the bottom bar.
Here's a project with just the two classes in it. JeanneTest behaves as expected. JeanneIT does not. Other than the name, the files are the same.
https://github.com/boyarsky/vs-code-test-runner-issue-381
jdneo commentedon Jun 18, 2019
Root Cause
We are using Junit 5's junit-platform-console to launch the test execution. The CLI has an option to restrict the class name,
see here: https://github.com/junit-team/junit5/blob/master/junit-platform-console/src/main/java/org/junit/platform/console/options/AvailableOptions.java#L172-L177
Workaround
You can change the default value by setting a workspace setting for
java.test.config{ "java.test.config": { "args": ["--include-classname", ".*"] } }Open the
Settingpage and clickEdit in settings.jsonFollow-up
If the user does not set
-nor--include-classnamein args, we set it to.*.Otherwise, we use the args that user provides.