ソフトウェアのテストで使用するブラックボックステストにおけるテストケースの作り方として, 適切なものはどれか。
平成26年度 春期 ITパスポート試験 問35
This question's explanation and your answers so far.
問 35
Incorrectア
“So that every branch is executed at least once” describes branch coverage (decision coverage) in white-box testing. You cannot tell how many branches there are without reading the source code, and once it presupposes the internal structure it is no longer black-box testing.
Incorrectイ
“So that all combinations of branch conditions are executed” describes multiple condition coverage (condition-combination coverage) in white-box testing. It is a coverage criterion that goes even further into the internal code structure than ア, so it is not a way of designing black-box tests, which look only at the external specification.
Incorrectウ
“So that every statement is executed at least once” describes statement coverage in white-box testing. Measuring the coverage rate at the statement level requires the source code, and this too is a technique based on the internal structure, so it does not qualify as black-box testing.
- エ
正解 The correct answer is エ. Black-box testing is a technique for designing test cases without looking at the internal structure of the program (the statements and branches in the source code) at all, relying only on the external specification written in the specification document — the idea that “if you give this input, you should get this output.” Because there are countless possible input values, in practice we use the idea of equivalence partitioning: events that are expected to behave the same way — such as normal cases (the range of inputs processed as specified) and error cases (the range of inputs rejected by the specification) — are gathered into groups (equivalence classes), and one representative value is chosen from each group for testing. Choice エ, “divide possible events into several groups and select test data so that each group is executed at least once,” is exactly this description of equivalence partitioning, and it does not touch the internal structure, so it is appropriate as a way of designing test cases for black-box testing.
- Black-box testing = designing test cases only from the external specification (the relationship between inputs and outputs), without looking at the internal structure; its representative techniques are equivalence partitioning and boundary value analysis. White-box testing = designing test cases based on the internal structure, using coverage criteria such as statement coverage, branch coverage, and condition coverage.
- Equivalence partitioning is a method of gathering inputs that are expected to produce the same result into a group (an equivalence class) and then choosing one representative value from each group. Whenever wording about grouping by event appears, such as “normal cases” and “error cases,” you can judge that it belongs to the black-box side.