State Transition Testing: Flight Booking
State transition testing on a seat booking with a payment timer.
Requirements
- The page shows a flight card for Tallinn → London: the price of 150 € (Price), one seat (Seats), the current status (Status), and the time left on the booking (Time left). The Book, Pay, and Cancel booking buttons can be pressed in every state. Payment is simulated, and no bank details are requested.
- The seat is in one of these states: Available — the seat can be booked; Booked — the seat is held while payment is pending; Ticket purchased — the purchase is complete. When the page opens, the status is Available, and the timer is not running and shows “—”.
- Book in the Available state moves the seat to Booked and starts a 45-second countdown: “Seat booked. Pay for the ticket within 45 seconds”. Pressing Book again during an active booking does not change the state or extend the booking: “You already have an active booking”.
- Pay during an active booking, while more than 0 seconds are left, moves the seat to Ticket purchased: “Ticket purchased successfully”. The timer stops and is hidden. With 0 seconds left, payment is not possible: the booking expiry takes priority over payment.
- Cancel booking during an active booking returns the seat to Available: “Booking cancelled”. The timer stops and shows “—”.
- If the booking is not paid within 45 seconds, it is released automatically: the seat is Available again, the timer shows “—”, and the message is “Booking time has expired”. The booking timer must not affect a ticket that has already been purchased.
- After a booking is cancelled or expires, the seat can be booked again. A new booking always lasts the full 45 seconds.
- Forbidden actions show an error and change neither the state nor the timer. In Available: Pay — “Book a seat first”, Cancel booking — “You have no active booking”. In Ticket purchased: Book — “Ticket already purchased”, Pay — “Ticket already paid”, Cancel booking — “A purchased ticket cannot be cancelled”. Ticket refunds are not supported.
- A message stays on screen until the next action or automatic event. Start over returns the trainer to its initial view from any state and stops the timer. Nothing is saved: reloading the page also resets the trainer.
Task
- Study the state transition diagram and compare it with the requirements: find every state, event, and forbidden action on it.
- Write a checklist that covers every allowed transition and every forbidden action.
- Check booking again after a cancellation and after the time runs out.
- Check how the timer behaves after a purchase.
- Run your checks in the app below and write bug reports for any mismatches with the requirements.
Application under test
Flight booking
- Route
- Tallinn → London
- Price
- 150 €
- Seats
- 1
- Status
- Available
- Time left
- —
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.