Sonarqube Jacoco Maven includes coverage for failed test

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    jacoco-maven-plugin: 0.8.6
  • what are you trying to achieve
    Includes coverage for failed tests.
    I am working on a project that has a lot of failed tests. I am trying to find out which code are not covered by any tests. Currently no coverage was shown.
  • what have you tried so far to achieve this
    Tried these two flags:


Log Snippet

[ERROR] Tests run: 57, Failures: 3, Errors: 39, Skipped: 0

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project PROJ: There are test failures.
[ERROR] Please refer to D:\PROJ\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

Hey there.

I’m a little confused by your question.

If your JaCoCo report is displaying coverage for failed/errored tests, you probably want to get in touch with GitHub - jacoco/jacoco: Java Code Coverage Library. SonarQube doesn’t generate coverage reports, it only reads them.

If your JaCoCo report isn’t showing coverage for failed/errored tests, and you want it to… that’s probably not possible. Imagine if your test errors on the first line… there’s no way coverage could have been collected for that test.

It’s the latter, thanks!

Weird question from me but thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.