Coverage for long running tests


we are using

  • SonarQube 7.9 LTS
  • sonar-maven-plugin 3.7.0

We’d like to show coverage data on our project. However, our tests are currently only executed once per day, our analysis multiple times. What would happen if we provide coverage data only during a single analysis? Would the coverage on the project page vanish after an analysis without coverage data? Would the coverage simply be outdated or could lead to server/analyzer errors?
Does someone have experience with long running tests and coverage in SonarQube?


If you provide no coverage data – yes, your coverage would disappear.

If you provide an outdated coverage report, it could lead to a scanner failure (say, if the coverage report refers to a line that no longer exists).

The general expectation is that fresh coverage data is available for every SonarQube analysis to consume.

Hi Colin,

thanks for your quick reply.

I thought that was weird because I did a test with a small project where I changed the project’s pom not to provide any Jacoco files and the coverage was still present. The tests were still executed and coverage reports generated; I assume the scanner checked the default location, found reports and used those?
When I disabled test execution the coverage was gone as you said.

I guess the only chance to have coverage in SonarQube is to create a second project with the same content and perform an analysis only when coverage reports are available?

That’s correct

If you really can’t have your tests run before each SonarQube analysis, you will have to get creative. To be honest – having tests only run once a day seems like an antipattern. Your developers only know if they broke something until the day after?

Well, we excute a fraction of our whole test suite for each commit, with those tests as relevant to each individual commit as possible.
Currently, it’s not realistic to execute the complete test suite more than once per day; splitting the project into modules and different (SonarQube) projects isn’t possible, yet.
Anyway, thank for your help. Now, at least, I know what I don’t need to try :wink:

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