Foundation Level study guide

Statement vs Branch Coverage

Statement and Branch Coverage are white-box (structure-based) metrics used to measure the thoroughness of testing at the source code level. Statement coverage measures the percentage of executable statements run, while Branch coverage measures the percentage of branches exercised, including conditional and unconditional branches.

Practical example

Imagine an if (x > 10) { print("High"); } block without an else. If you pass x = 15, the print statement executes. You have achieved 100% Statement Coverage. However, you completely missed testing what happens when the if condition evaluates to False. The exact branch coverage depends on all branches represented in the control-flow graph.

Exam scenario and common trap

Question: If a test suite achieves 100% Branch Coverage, does it guarantee 100% Statement Coverage? The Trap: "No, they are completely separate metrics." The Correct Answer: Yes. 100% Branch Coverage mathematically guarantees 100% Statement Coverage. However, 100% Statement Coverage does not necessarily guarantee 100% Branch Coverage.

Related syllabus sections cover this topic. Reference sections: 4.3.1–4.3.2. See the official ISTQB syllabus for exam scope. Examples are independent; QA-ace is not affiliated with ISTQB.