WBJECA 2025 — Computer PYQ
WBJECA | Computer | 2025Which testing approach specifically ensures that all logical conditions in a decision are tested at least once?
Choose the correct answer:
- A.
Statement Coverage
- B.
Branch Coverage
- C.
Path Coverage
- D.
Condition Coverage
(Correct Answer)
Condition Coverage
Explanation
Explanation:
In white-box testing, coverage metrics help determine how much of the source code has been exercised by the test suite.
Condition Coverage (Predicate Coverage): This specifically focuses on ensuring that each individual logical condition within a decision (e.g., in an
ifstatement likeif (A || B)) is evaluated to bothtrueandfalseat least once.
To illustrate the difference, consider a simple decision: if (A || B).
Branch Coverage would ensure the entire
ifstatement evaluates to bothtrueandfalse.Condition Coverage requires that:
Condition A is tested as {True,False}
Condition B is tested as {True,False}
Mathematically, we can represent the relationship of these metrics based on their strictness:
Path Coverage⟹Branch Coverage⟹Statement Coverage
And specifically for the logical conditions:
Condition Coverage⟹Individual sub-expression evaluation∈{True,False}
By verifying each sub-condition, Condition Coverage provides a higher level of detail regarding the internal logic compared to just checking the overall branch outcome.
