Test Design
State Transition Testing
Testing based on how the system transitions between different states in response to events.
Full definition
State transition testing models the system as a finite state machine — it has defined states and transitions triggered by events. This technique is effective for testing workflows, user journeys, and systems with sequential behavior.
Components:
- States: The conditions the system can be in (e.g., Logged Out, Logged In, Locked)
- Transitions: How the system moves between states (e.g., 'enter correct password' → Logged In)
- Events: Actions that trigger transitions (e.g., click login, enter password)
- Guards: Conditions that must be true for a transition (e.g., password correct)
Example — ATM PIN entry:
- State 1: Waiting for PIN
- Event: Enter wrong PIN → State 2: 1st attempt failed
- Event: Enter wrong PIN → State 3: 2nd attempt failed
- Event: Enter wrong PIN → State 4: Card blocked
- Event (any state): Enter correct PIN → State 5: Authenticated
State transition diagrams visualize the model. State transition tables enumerate all state/event combinations systematically.
This technique is essential for testing multi-step processes, shopping carts, order management, and authentication flows.