ISTQB Certified Tester Foundation Level v4.0 — Question 22
How is branch coverage determined?
Answer options
- A. By taking the number of branches in the code that have been tested and dividing that by the number of total branches in the code
- B. By taking the number of branches in the code on one path that has been tested and dividing that number by the total paths through the code
- C. By taking the number of statements in the code and dividing those by the number of branches that have been tested
- D. By counting the number of branches in the code that have been tested
Correct answer: A
Explanation
The correct answer, A, accurately describes branch coverage as the ratio of tested branches to total branches. Option B incorrectly refers to paths rather than branches, which is not how branch coverage is calculated. Option C misrepresents branch coverage by focusing on statements instead of branches, while option D lacks the necessary division to quantify coverage.