How to get coverage diff between two versions on a file-by-file basis

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube - * Community Edition Version 9.6.1 (build 59531)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
    get info on lesser coverage in current release at individual file level
  • what have you tried so far to achieve this
    tried if the “New Code” approach, or the web API /history might provide something, but the API only provides historical coverage numbers at project level

More details with example
We have weekly Prod releases, and QA accordingly executes the regression suites every week (call it W1, W2, etc.). One of the factors to decide Go-live is the confidence from code coverage.

  • So week W1 had, say for example - 60%
  • and week W2 had, say for example - 50%

Assuming we executed the same test suites in both weeks, I want to know how there is huge difference in the metrics, i.e., where is the diff of 10% coming from? Which files have reported lesser coverage in W2 as compared to W1?

Is there a way to get this info ?



As you’ve noted, we only store historical data at project level.

I urge you to analyze at least daily and ideally commit-by-commit if you’re not already. Then pay closer attention to the Coverage on New Code through the week. Then it becomes not a question of “Which file’s coverage dropped?” But of which changes need covering.