What is the difference between code coverage and line coverage in sonar

前端 未结 2 813
梦谈多话
梦谈多话 2021-02-01 18:36

I know what the difference is between line and branch coverage, but what is the difference between code coverage and line coverage? Is the former instruction coverage?

2条回答
  •  眼角桃花
    2021-02-01 18:51

    Coverage is a subtle ;-) mix of the line and the branch coverage.

    You can find the formula on our metric description page:

    coverage = (CT + CF + LC)/(2*B + EL)
    
    where
    
    CT - branches that evaluated to "true" at least once
    CF - branches that evaluated to "false" at least once
    LC - lines covered (lines_to_cover - uncovered_lines)
    
    B - total number of branches (2*B = conditions_to_cover)
    EL - total number of executable lines (lines_to_cover)
    

提交回复
热议问题