Branch Testing & Coverage Items
1. Introduction
This question focuses on branch testing, a white-box test technique. To answer it correctly, you must know what counts as a coverage item and how to count them in a control flow graph (CFG).
이 문제는 화이트박스 테스트 기법 중 하나인 분기 테스트(Branch Testing)를 다룹니다. 핵심은 커버리지 아이템이 무엇인지, 그리고 제어 흐름 그래프(Control Flow Graph)에서 어떻게 세는지입니다.
2. Key Concept: Branch Testing
In branch testing:
- Coverage items are branches
- Branches are represented by the edges of a control flow graph
So, to determine the number of coverage items, you simply count the number of edges in the graph.
분기 테스트에서는:
- 커버리지 아이템 = 분기(branch)
- 분기는 제어 흐름 그래프의 간선(edge)으로 표현됨
따라서 그래프에 있는 간선의 개수가 곧 커버리지 아이템의 개수입니다.
3. Practice Question
❓ Question
You want to apply branch testing to the code represented by the following control flow graph.
How many coverage items do you need to test?
- a) 2
- b) 4
- c) 8
- d) 7
✅ Correct Answer: c) 8
4. Explanation (EN / KR)
✔ Why the answer is 8 — Correct
In branch testing, the coverage items are the branches, which correspond to the edges in the control flow graph.
The given control flow graph contains 8 edges. Therefore, 8 coverage items must be tested to achieve 100% branch coverage.
분기 테스트에서는 커버리지 아이템이 분기(branch)이며, 이는 제어 흐름 그래프의 간선(edge)과 동일합니다.
해당 제어 흐름 그래프에는 간선이 8개 있으므로, 필요한 커버리지 아이템의 수는 8개입니다.
❌ Why the other options are incorrect
- a) 2: Too low — does not reflect the number of branches
- b) 4: Counts something other than branches (e.g., decisions)
- d) 7: Incorrect edge count
- 2: 분기 수보다 훨씬 적음
- 4: 결정문 수 등 다른 요소를 센 경우
- 7: 간선 수 계산 오류
5. Summary Table
| Testing Type | Coverage Item | How to Count | 한글 요약 |
|---|---|---|---|
| Branch testing | Branches | Number of edges in CFG | 간선 개수 |
6. Final Takeaway
For ISTQB exams, remember this rule:
Branch coverage items = edges in the control flow graph
시험에서는 이렇게 기억하세요.
분기 테스트의 커버리지 아이템 수 = 제어 흐름 그래프의 간선 수
Related: More ISTQB Posts | Next Question
