SonarQube calculation coverage


I am trying to calculate the coverage using the following formula:

coverage = (CT + CF + LC)/(2*B + EL)

how these values ​​are specified?
What is the metric key you should be looking for?
¿CT + CF = cover_conditions - discovered_conditions?


Here’s an easier way to think about it (PR to the docs coming eventually)

Coverage ( coverage )
It is a mix of Line coverage and Condition coverage. Its goal is to provide an even more accurate answer to the following question: How much of the source code has been covered by the unit tests?

Coverage = (Covered Conditions + Covered Lines)/(Conditions to Cover + Lines to Cover)

  • Covered Conditions = conditions_to_cover - uncovered conditions
  • Covered Lines = lines_to_cover - uncovered_lines
  • Conditions to Cover = total number of conditions ( conditions_to_cover )
  • Lines to Cover = total number of executable lines ( lines_to_cover )


Coverage = ( conditions_to_cover - uncovered conditions + lines_to_cover - uncovered_lines ) / ( conditions_to_cover + lines_to_cover )

voy a reformular las preguntas que no fui especifico:

  • como puedo comparar los resultados del codo coverage del visual studio test(vstest)
    con los del sonarqube?, es decir, como puedo hacer que el sonarquebe arroje los mismos resultados del coverage del vstest debido a que sus valores arrojados son distintos.
    adjunto imagen de resultados arrojados en vstest y en otra respuesta adjunto el resultado sonarqube respectivamente:

  • como puedo hallar los valores de conditions_to_cover y uncovered_conditions en
    los valores del code coverage del vstest?


A post was merged into an existing topic: Rolling up Sonarqube File Code Coverage Stat to Module level