Key

This line was added.

This line was removed.

Formatting was changed.

Tests

Metric

Key

Description

Supported by

Branch coverage

branch_coverage

On each line of code containing some boolean expressions, the branch coverage simply answers the following question: 'Has each boolean expression been evaluated both to true and false?'. This is the density of possible branches in flow control structures that have been followed.

Code Block

Branch coverage = (CT + CF) / (2*B)
where
CT = branches that have been evaluated to 'true' at least once
CF = branches that have been evaluated to 'false' at least once
(CT + CF = conditions_to_cover - uncovered_conditions)
B = total number of branches (2*B = conditions_to_cover)

Coverage

coverage

It is a mix of Line coverage and Branch 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?".

Code Block

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

Line coverage

line_coverage

On a given line of code, Line coverage simply answers the following question: 'Has this line of code been executed during the execution of the unit tests?'. Tis is the density of covered lines: