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

Have unit tests update coverage files afterwards.

Open eak006 opened this issue 3 years ago • 3 comments

Is it possible to run a JUnit test(s) through the vscode-java-test plugin and have the coverage XML files updated immediately afterwards?

I'm using the Coverage Gutters plugin by ryanluker to read my coverage files and light up my source code with green/red if, respectively, a unit test has/hasn't executed the source line.

In my build.gradle file, I have the jacocoTestCoverageVerification task defined, as well as the jacocoTestReport task to generate the coverage html and xml files. Can't share since it's proprietary.

I have this in my local workspace's settings.json:

"java.test.config": {
  "name": "myConfiguration",
  "workingDirectory": "${workspaceFolder}",
  "args": ["jacocoTestReport"],
},
"java.test.defaultConfig": "myConfiguration",

Any help provided is greatly appreciated!

eak006 avatar Apr 28 '21 20:04 eak006

Just for clarification, the Coverage Gutters plugin reads in the coverage XML files from a specific directory. I want to know if this plugin can implicitly update that directory after running a unit test via the sidebar or the Run Test/Debug Test options shown directly above a unit test method.

eak006 avatar Apr 28 '21 20:04 eak006

Code coverage will be a important story we will visit in the near future. (By adopting the VS Code new Testing APIs: https://github.com/microsoft/vscode/issues/107467#issuecomment-822849983)

jdneo avatar Apr 29 '21 01:04 jdneo