This article describes the following three types of coverage.
--Statement coverage (C0: instruction coverage) --Branch coverage (C1: branch coverage) --Simple condition coverage (C2: condition coverage)
if (Conditional statement a1||Conditional statement a2) { //Judgment condition A
Statement 1 } else{ Statement 2
} if (conditional statement b1 && conditional statement b2) {// Judgment condition B Statement 3 }
--The percentage of executable statements (instructions) that were executed in the test **
⇒ For 100% coverage, all executable statements must be executed at least once
--Three test cases are required to execute statements 1 to 3
--Of all the judgment conditions, ** the ratio of judgment conditions executed in the test **
⇒ In order to achieve 100% coverage, it is necessary to execute the truth of each judgment condition at least once.
--The following two test cases are required (* It can be confirmed that the truth of each judgment condition is executed at least once)
――Of all the conditional statements, ** the ratio of the conditional statements executed in the test **
⇒ In order to achieve 100% coverage, the truth of each conditional statement must be executed at least once.
--The following two test cases are required (it can be confirmed that the truth of each conditional statement has been executed at least once)
――In addition, even if the coverage of C2 is 100% as in the above example, the coverage of C0 and C1 is not always 100%.
-About coverage (C0 / C1 / C2 / MCC) in white-box testing -What is coverage analysis
Recommended Posts