Combining code coverage from different scans

Must-share information (formatted with Markdown):

  • SonarQube 8.9.1, Gitlab 14.1 EE, Language GOlang
  • We’ve split test execution into several Jobs (1x unit test, Nx integration tests) for parallel execution we want to get merged coverage
  • We are running sonar-scanner during the individual jobs

In some earlier topic I saw the request to see unit test coverage and integration test coverage separated, which apparently is not possible anymore as coverage is deliberately combined. Great that’s what we want, with a twist…

We have plenty of integration tests. To speed our pipelines we’ve split them into several Gitlab jobs. However we are struggling to get the separate coverage reports generated by those jobs combined by SonarQube. Can anyone point us in the right direction?

Thanks in advance,

Hi Joachim,

You need to run analysis only after all the test jobs are complete. Hopefully that will work, although you may face trouble if the file paths in the reports are absolute and they don’t match the paths on the build agent analysis finally runs on.