Understanding 100% Statement Coverage
1. Introduction
In the ISTQB Foundation Level exam, questions about code coverage metrics often test your understanding of what each coverage level guarantees — and what it does not.
This question focuses on the meaning and limitations of 100% statement coverage.
ISTQB 시험에서는 코드 커버리지(coverage)에 대해 잘못된 오해를 구분할 수 있는지를 자주 묻습니다.
이 문제는 문장 커버리지(Statement coverage)가 무엇을 보장하는지 정확히 이해하고 있는지를 확인합니다.
2. Practice Question
❓ Question
Your test suite S for a program P achieves 100% statement coverage.
It consists of three test cases, each of which achieves 50% statement coverage.
Which of the following statements is CORRECT?
- a) Executing S will cause all possible failures in P
- b) S achieves 100% branch coverage for P
- c) Every executable statement in P containing a defect has been run at least once during the execution of S
- d) After removing one test case from S, the remaining two test cases will still achieve 100% statement coverage
✅ Correct Answer: c)
3. Explanation
✔ c) Every executable statement containing a defect has been run — Correct
100% statement coverage means that every executable statement in the program has been executed at least once.
Therefore, if a statement contains a defect, that statement must have been executed during the test execution.
However, executing a defective statement does not necessarily cause a failure.
문장 커버리지 100%는 모든 실행 가능한 문장이 최소 1번 실행되었음을 의미합니다.
따라서 결함이 있는 문장도 반드시 실행되었으며, 이 설명이 정확하므로 c)가 정답입니다.
❌ a) All possible failures will be revealed — Incorrect
Executing a statement does not guarantee that it will fail, even if it contains a defect.
For example:
x := y / z
This statement is executed, but it only fails when z = 0.
결함이 있는 문장이 실행되더라도, 특정 조건이 만족되지 않으면 실패가 발생하지 않을 수 있습니다.
따라서 모든 실패가 발생한다고 볼 수 없습니다.
❌ b) 100% statement coverage implies 100% branch coverage — Incorrect
Statement coverage and branch coverage are different metrics.
Example:
IF (x = 0) THEN A; ENDIF
If x = 0, statement A is executed and
100% statement coverage is achieved,
but the false branch is never executed.
문장 커버리지 100%라도 모든 분기(branch)가 실행되었다는 보장은 없습니다.
❌ d) Removing one test case still keeps 100% coverage — Incorrect
Even though each test case achieves 50% statement coverage, they may cover different statements.
Removing one test case may remove coverage for statements that are not covered by the other two.
각 테스트 케이스가 커버하는 문장이 다를 수 있으므로, 하나를 제거하면 100% 커버리지가 깨질 수 있습니다.
4. Summary Table
| Statement | Correct? | Reason | 요약 |
|---|---|---|---|
| a | ✖ No | Execution does not guarantee failure | 실행 ≠ 실패 |
| b | ✖ No | Statement ≠ Branch coverage | 커버리지 차이 |
| c | ✔ Yes | All statements executed at least once | 정의에 부합 |
| d | ✖ No | Coverage may be lost | 보장 안 됨 |
5. Final Takeaway
For the ISTQB exam, remember this key rule:
100% statement coverage guarantees execution of all statements, but it does NOT guarantee failure detection or full branch coverage.
시험 대비 핵심 문장입니다.
문장 커버리지 100%는 모든 문장이 실행되었음을 의미할 뿐, 모든 실패나 분기 커버리지를 보장하지는 않는다.
Related: More ISTQB Posts | Next Question