How SonarQube Cloud generate coverage

Hello everyone,

As far as I know (from here: Test coverage parameters | SonarQube Cloud Documentation) SonarQube Cloud doesn’t run test cases itself, but generate coverage by coverage report that are generated by external tool. Now, i want to make the same coverage score in my gitlab ci pipeline with lcov.info for JS services and cover.out for Go services. Is there any library that you guys use to map coverage report into the files? Or you guys just built your own tools to calculate that?

Thanks

is this coverage formula still relevant

coverage = (CT + LC)/(B + EL)

where:

  • CT = conditions that have been evaluated to ‘true’ at least once
  • LC = covered lines = linesToCover - uncoveredLines
  • B = total number of conditions
  • EL = total number of executable lines (linesToCover)

ref: Code metrics | SonarQube Server Documentation

or do you guys use line coverage to generate this overall coverage?

Hi,

Yes, that’s correct (with the caveat that you have to actually pass the coverage reports into analysis :sweat_smile: )

We built our own tools.

Yes.

 
HTH,
Ann

1 Like