Test Techniques and Test Case Design
Test Techniques and Test Case Design
This is the highest-yield domain: given a specification fragment, choose the technique that derives the smallest effective set of cases, and be able to compute coverage. Questions combine technique selection, case enumeration and coverage arithmetic.
Black-box techniques
- Equivalence partitioning splits the input domain into classes the program should treat identically; every valid and invalid class needs at least one case, and classes must not overlap.
- Boundary value analysis targets the edges of ordered classes, where off-by-one errors live. Three-value BVA for the interval 18 to 60 tests 17, 18, 19, 59, 60, 61; two-value BVA tests only 18 and 60.
- Decision tables capture condition combinations and resulting actions; n conditions give up to 2^n rules, minus infeasible ones.
- Cause-effect graphing builds a Boolean graph from the specification before deriving the decision table; useful when conditions interact.
- State transition testing models states, events, guards and actions; 0-switch covers every transition once, 1-switch covers every pair of adjacent transitions.
- Orthogonal arrays and pairwise design compress a large combination space while preserving all pairs of values.
- Scenario testing walks use-case main and alternative flows; error guessing relies on experience with typical faults.
White-box techniques and coverage strength
Statement < decision (branch) < condition < decision/condition < multiple-condition < path. Two facts decide many questions. First, 100% statement coverage does not imply 100% decision coverage: an empty true branch executes no statement. Second, 100% condition coverage does not imply decision coverage: every condition can be exercised true and false while the decision itself never evaluates to false.
Worked example
Rule: a discount applies when the customer is a member AND the order exceeds 1000. As a truth table the rule yields four rules, so decision-table testing needs four cases (TT, TF, FT, FF). If the criterion is MC/DC, however, each condition must be shown to independently affect the outcome, which requires n + 1 = 3 cases for two conditions. Answering 4 when MC/DC is requested, or 3 when full decision-table coverage is requested, is the common error.
Traps
Overlapping equivalence classes (age < 18 combined with age ≤ 18); testing boundaries for a half-open interval as though it were closed; assuming a higher coverage percentage necessarily means a better test set; forgetting invalid inputs entirely.
Key ideas
Techniques are complementary: partition and boundary to select data, decision tables and state models to select combinations and sequences, white-box metrics to measure what the suite actually exercised.