Decision Table Testing & State Transition Testing
Build a decision table from combined conditions and derive tests from a state diagram, including an invalid transition.
Decision table testing systematically covers combinations of conditions that drive business logic. Each condition is a row with possible values (often true/false); each column is a rule — one specific combination of condition values mapped to one or more resulting actions. With n boolean conditions there are up to 2ⁿ possible rules, but a condition that doesn't actually affect the outcome for some combinations can be marked "don't care" and the table collapsed — one rule becomes one test case, and the table's structure is what proves no combination was skipped.
State transition testing models a system as a finite set of states, with transitions between them triggered by events (a state diagram, or an equivalent state table whose empty cells make invalid transitions explicit). The syllabus covers three coverage criteria, from weakest to strongest:
- All states coverage — every state exercised at least once.
- Valid transitions coverage, also called 0-switch coverage — every valid transition exercised; the most widely used criterion, and it guarantees full all-states coverage.
- All transitions coverage — every valid transition exercised and every invalid transition attempted; a minimum requirement for safety-critical software.
Testing only one invalid transition per test case avoids defect masking, where one defect hides another.
Both techniques share a strength: they turn business rules that would otherwise live only in a developer's head (or an ambiguous requirement) into an explicit, exhaustible list — which is what makes them easy to review with a business stakeholder before a single test is written.
Real-world use case
An order-status field that a bug lets jump straight from "Placed" to "Delivered" — skipping "Shipped" entirely — is a state transition defect. A tester who only walks the diagram's happy path (Placed → Shipped → Delivered) never finds it; a tester who deliberately tries the invalid transition (attempting Placed → Delivered directly) does.
Example code
Exercise
A shipping rule: free shipping applies if the customer is a member AND the order subtotal is $25 or more. Build a limited-entry decision table with these two conditions (using T/F for conditions and X for the resulting action), showing all rules.
Read-only here — open the English track at /learn to write and edit this exercise.
Quiz (3)
1. A decision table has 3 independent boolean conditions with no "don't care" simplification. How many rules (columns) fully cover every combination?
2. Why is deliberately testing an invalid state transition valuable, rather than only testing the diagram's valid paths?
3. What distinguishes "all transitions coverage" from "valid transitions coverage (0-switch coverage)"?