How would you test state transitions when many inputs interact and historical defects cluster around boundaries?
Answer
Model valid states, events, guards and forbidden transitions first, including what should happen after invalid or repeated events. Use historical defects to identify risky guards and boundaries, then combine state-transition coverage with decision tables or pairwise selection instead of attempting every input permutation. Automate stable high-value paths and assert the resulting state, side effects and recoverability after interruption or retry.
Strong answer includes
- models states, guards and invalid transitions explicitly
- uses defect history to focus combinatorial coverage
- checks side effects, retries and recovery
Practical example
For example, an order-processing state machine has states like Draft, Submitted, PaymentPending, Shipped and Cancelled, and defect history shows most bugs happen when a cancel request arrives while payment is mid-flight. The tester builds a decision table combining state, payment-gateway response and network timeout, automates the case where a cancel is submitted right after a payment timeout, and asserts the order ends in a consistent Cancelled-and-refunded state rather than a stuck PaymentPending record with money already charged.