Sonar-Overall Coverage

前端 未结 2 757
礼貌的吻别
礼貌的吻别 2021-01-02 21:45

Sonar gives a value of Overall coverage which is a combination of line and branch coverage. I am not sure how important is this metric. What does the value of overall covera

2条回答
  •  抹茶落季
    2021-01-02 22:14

    From Sonar's documentation:

    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 = (CT + CF + LC)/(2*B + EL)
    
    where
    
    CT = conditions that have been evaluated to 'true' at least once
    CF = conditions that have been evaluated to 'false' at least once
    LC = covered lines = lines_to_cover - uncovered_lines
    
    B = total number of conditions
    EL = total number of executable lines (lines_to_cover)
    

    Source: https://docs.sonarqube.org/display/SONAR/Metric+Definitions#MetricDefinitions-Tests

提交回复
热议问题