State Transition Testing: Sign-in Lockout
State transition testing on a lockout after three wrong passwords.
Requirements
- When signing in, the system counts failed password attempts. The error counter starts at 0. Each wrong password increases it by 1. If the user enters the correct password before the third error, they sign in successfully and the counter resets to 0.
- After three wrong passwords in a row, sign-in is locked for 5 minutes. During this time, the user cannot sign in even with the correct password. Repeated attempts do not extend the lock. After 5 minutes the lock is lifted automatically, the error counter resets to 0, and the user can try again.
- The correct test password is Secret123. Sign in is disabled while the password field is empty. After a successful sign-in, Sign out returns to the sign-in form.
Task
Draw a state diagram: which states the sign-in has, which events change them, and where they lead. Build tests that go through every transition and check them in the app below.
Application under test
Correct password: Secret123
Sign in
✓ Signed in successfully
Quick reference
State transition testing
A technique for systems whose behaviour depends not only on the input but also on what happened before. The same action (for example, entering the correct password) gives different results in different states.
States, events, transitions
A state is a situation the system is in. An event is something that happens (a password is entered, time runs out). A transition is a change of state in response to an event. All of this fits well into a state diagram or a state transition table.
Coverage
The minimum is to visit every state. A stronger goal is to cover every transition. Invalid transitions are checked separately: events that should change nothing in a given state.