Hi, we’ve got strange issue and to be honest I’ve got no idea how to struggle with it for now. Maybe you will have some ideas
In one of our project we have a bunch of repositories and huge SonarQube Cloud configuration and everything was working excellent. Unfortunately, one day we’ve lost about 20% of coverage without any change. Used Quality Gate profile also remains the same. Command like sonar.verbose=true gave us more diagnostic data but anything specific. It was around March and April and from this time overall coverage score is decreased by around 20% than the original one. We were trying to rollback till the changes which were given to the repo at the end of February, but anything changed/restored. In one of previous commits before this coverage has been lost there was added around 4k lines of code covered by the proper unit tests.
Do you have any ideas how to debug this case? Any tips or tricks?
To troubleshoot, it’s usually best to start by comparing your raw coverage reports with what SonarQube Cloud is showing. That means checking for files you expect to have coverage that are being reported as 0%, and also looking out for any files that shouldn’t be included in coverage calculations (like test files) but still appear in the report. The Measures tab of your project is useful for this.
A particularly useful resource is the documentation on setting analysis scope. Double-check whether your files are properly categorized as sonar.sources or sonar.tests (files categorized as tests aren’t counted towards the test coverage metric)
Keep in mind, SonarQube treats your coverage report at face value: it doesn’t recalculate or interpret coverage beyond what’s in the report*. So, it’s essential to ensure that your coverage report itself is accurate and up to date. If the 20% loss comes because your coverage tool became misconfigured or isn’t catching new coverage data, SonarQube Cloud will never be right.
Hope that helps!
* if a source file is completely absent from the coverage reports, SonarQube will do it’s best to estimate what lines of a file are “executable” and therefore could be covered by tests
The problem is I am using this tab and except decrease of coverage at mentioned time there are no further information. My investigation discovered that one of the projects in scope has got 0% coverage for some reason. At the end of March the coverage for such project was greater than 0% for sure so I am digging into it right now.