SonarQube Coverage Report is Spiking and Falling

Version: 7.9.5
My coverage reports are spiking high and low. For example each time sonar builds coverage report the % of code covered will be in the 80% then when i build again it unexpectedly drops to 30%. If i build again a few more times it jumps back to 80%. And so on so forth. This happens even if there is no code change, I’ve exhausted everything that i can try. Hoping someone here can help me figure out why it is spiking.

Hey there.

First of all – you should know that SonarQube v7.9 LTS is an EOL version of SonarQube. You should upgrade to at least v8.9 LTS at the earliest.

I would suggest checking your build/scanner logs and making sure that between runs (one high, one low):

  • A full rebuild of your code is taking place
  • The number of successful tests are the same (example for Maven)
-------------------------------------------------------

T E S T S

-------------------------------------------------------

Running com.acme.basic.HelloWorldTest

Hello World!

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  • The number of indexed files are the same (scanner logs)

INFO: 15 files indexed

If it doesn’t become obvious where the issue is, try upgrading to v8.9 LTS and come back so we can provide more help.

Colin

Thank you,
I’ll check those three and hopefully that reveals it self.