Software Testing

Intermediate path · lesson 5 of 19

IntermediateTest design5 min readPublished November 12, 2026

State transition testing

Orders, accounts, tickets and subscriptions move through states. State transition testing checks every allowed move, and makes sure the forbidden ones really are forbidden.

On this page

Key takeaways

  • Many systems behave differently depending on their current state: the same action is allowed on a new order and forbidden on a shipped one.
  • Model the system as states, events and transitions, in a diagram or a state table. Then derive tests from the model.
  • Test the valid transitions, and also the invalid ones: actions the system must refuse in a given state. That's where many serious bugs hide.

Where this picks up

The techniques you've used so far, partitions, boundaries and test cases, look at inputs. But a "Cancel" button can be correct for one order and dangerous for another. The difference isn't the input. It's the history: what state the order is in.

State transition testing is the technique for that kind of behaviour.

The vocabulary

  • State: a situation the system is in, which affects how it responds. Paid, Shipped.
  • Event: something that happens. Customer cancels, Courier collects parcel.
  • Transition: a move from one state to another, triggered by an event.
  • Guard (optional): a condition that must be true for the transition. Cancel, if less than 1 hour since payment.
  • Action (optional): what the system does during the transition. Send refund.

An example: an online order

The lifecycle of an order:

  • New → pay → Paid
  • New → cancel → Cancelled
  • Paid → ship → Shipped
  • Paid → cancel → Cancelled (action: refund)
  • Shipped → deliver → Delivered
  • Delivered → return → Returned (action: refund)

Drawn as a diagram, that's six arrows between six states. Each arrow is a valid transition.

The state table: where invalid transitions appear

A state table lists every state against every event. Cells with a valid transition show the target state. Empty cells are events that should be refused:

State \ Eventpaycancelshipdeliverreturn
NewPaidCancelled–––
Paid–CancelledShipped––
Shipped–––Delivered–
Delivered––––Returned
Cancelled–––––
Returned–––––

The diagram shows 6 transitions. The table shows 30 combinations, and 24 of them must be refused. Can you ship a cancelled order? Pay twice? Return something that was never delivered?

Coverage levels

The ISTQB syllabus describes three common levels, from weakest to strongest:

CoverageWhat it requiresFor the order example
All statesEvery state is visited at least onceA few long paths through the lifecycle
Valid transitionsEvery valid transition is exercisedAll 6 arrows
All transitionsEvery valid transition and an attempt at every invalid one6 valid + 24 invalid attempts

Valid transitions coverage is the usual minimum. For money, security or safety, aim for all transitions coverage, at least on the states that matter.

For risky flows, also test sequences of transitions: pay → cancel → pay again. Testing pairs of consecutive transitions is sometimes called 1-switch coverage. For guards, nested states, timeouts and recovery paths, see Advanced state-based testing.

Turning the model into tests

  1. Draw the model from the requirements. Ask the team to confirm it: disagreements here are early bugs.
  2. Build the state table to find all invalid combinations.
  3. Write test paths that cover the valid transitions, ideally starting from the initial state each time.
  4. Write one test per important invalid transition, with the expected refusal: an error message, a disabled button or an API error.
  5. Check the actions too: when an order is cancelled after payment, is the refund really sent, and only once?
Real-world exampleThe refund that happened twice

A shop's order system allowed Paid → Cancelled with a refund. The cancel button disappeared once an order was cancelled, so in the UI everything looked correct.

A tester built the state table and noticed Cancelled + cancel should be refused. She opened the order in two browser tabs and clicked Cancel in both.

Both requests were accepted. The customer received two refunds. The check happened only in the UI, not in the server's state logic.

Lesson: the diagram showed nothing wrong. The empty cell in the state table, tested through a second tab, found the bug.

Do

Test invalid transitions through the API or a second session, not just by looking for the missing button.

Don't

Stop at "the happy path goes through every state". Visiting every state can leave most transitions, and all the forbidden ones, untested.

Check yourself

A login allows 3 failed attempts; the third failure locks the account. An admin can unlock it. Which states and invalid transition would you test?

Show answer

States: Active (0 failures), 1 failure, 2 failures, Locked. Valid transitions: each failure moves one step on; a successful login before locking resets to Active; the admin unlocks Locked → Active. A key invalid transition: logging in with the correct password while Locked. It must still be refused.