View all services
Talk to QA Advisor
Free tool · Test design

State transition testing, generated

Orders, subscriptions, bookings, approvals and accounts all move through states, and the defects hide in the moves nobody expected. Describe the workflow as transitions and get the state table, every test it implies and the path to reach each one.

Runs entirely in your browser. Nothing you enter is sent to a server.

Describe a workflow as the moves between its states. You get the state table, a test for every allowed and every forbidden move, and the steps to reach each test’s starting point.

Try an example

From state, event, to state: Created, pay, Paid. The first state listed is where everything starts; to start somewhere else, add a line such as “start: Draft”.

End states (no way out): Cancelled, Refunded. Every event should be refused in these.

State table

Every state against every event. Green is where the event leads; “Invalid” is a move the system must refuse.

Paste into mermaid.live, GitHub or GitLab

State table
Statepaycancelshipdeliverreturnrefund
CreatedstartPaidCancelledInvalidInvalidInvalidInvalid
PaidInvalidRefundedShippedInvalidInvalidInvalid
CancelledInvalidInvalidInvalidInvalidInvalidInvalid
ShippedInvalidInvalidInvalidDeliveredInvalidInvalid
RefundedInvalidInvalidInvalidInvalidInvalidInvalid
DeliveredInvalidInvalidInvalidInvalidReturnedInvalid
ReturnedInvalidInvalidInvalidInvalidInvalidRefunded

Your tests

Every allowed move, once each. This is the usual minimum (valid transitions, or 0-switch, coverage).

TestTo get there from the startIn stateThen triggerExpected
T1Nothing: it is the start stateCreatedpay Moves to Paid
T2Nothing: it is the start stateCreatedcancel Moves to Cancelled
T3payPaidship Moves to Shipped
T4payPaidcancel Moves to Refunded
T5pay → shipShippeddeliver Moves to Delivered
T6pay → ship → deliverDeliveredreturn Moves to Returned
T7pay → ship → deliver → returnReturnedrefund Moves to Refunded
Export as

One row per test with title, steps and expected result. Imports into TestRail, Xray, Zephyr or a spreadsheet.

How to use

How to use the State transition test generator

  1. 1Start from an example such as Order or Subscription, or write one move per line as "From state, event, To state".
  2. 2Check the state table: every "Invalid" cell is a move the system must refuse.
  3. 3Run the allowed moves first, then the forbidden ones. Each test lists the events that get you to its starting state.
  4. 4Add two moves in a row for deeper coverage. Export any set as test cases, Markdown or Gherkin, or copy the diagram as Mermaid.

What state transition testing is

State transition testing is a black-box technique for anything whose behaviour depends on what has already happened. An order that has shipped cannot be cancelled the way an unpaid one can. A subscription in its grace period behaves differently from one that has lapsed. The same event produces different results depending on the state, and the test design has to account for that.

The model has four parts: states, events that trigger change, transitions from one state to another, and the actions that happen on the way. It can be drawn as a state transition diagram or written as a state table, and both describe exactly the same thing.

Coverage levels

All states coverage visits every state at least once. It is the weakest level, because a state can be reached without exercising most of the transitions into and out of it.

Valid transitions coverage, also called 0-switch coverage, exercises every valid transition at least once. It is the usual minimum, and it is what the valid transition tests here provide. All transitions coverage adds every invalid transition: each state and event combination the model does not allow, which should be refused or ignored. The ISTQB Foundation syllabus treats these as the three standard levels.

Two-step sequences, known as 1-switch coverage, test every pair of consecutive transitions. They find defects that depend on how a state was reached, such as a refund that works after a cancellation but not after a return.

Invalid transitions are where the defects are

Teams test the happy path through a workflow thoroughly, because that is what the requirement describes. The invalid transitions are rarely written down: shipping an unpaid order, refunding a delivered one twice, approving a request that was already rejected. Each is a single API call or a double click away, and each is a real defect when the system accepts it.

The state table makes them visible. Every empty cell is a test: trigger that event in that state, confirm it is refused, and confirm the state did not change. For anything involving money, a refused transition that still has side effects, such as a second refund email, is as serious as one that is accepted.

Setup paths

The hard part of most state transition tests is not the transition but getting to the starting state. To test a refund from a returned order, the order first has to be created, paid, shipped, delivered and returned. Each test here includes the shortest sequence of events from the start state, so the setup is written once, correctly.

If a state has no path from the start, the tool flags it as unreachable. That is almost always a modelling error, or a real defect in the workflow: a state the system can describe but never enter.

QAble service

Functional testing services

QAble models the workflows that carry money and data, then tests every transition, including the ones the requirement forgot to forbid.

Explore the service
FAQ

Frequently asked questions

What is state transition testing with an example?

It tests how a system moves between states in response to events. For an order that goes Created, Paid, Shipped, Delivered, the tests confirm each valid move works, such as paying a created order, and each invalid one is refused, such as shipping an order that has not been paid.

What is the difference between a state transition diagram and a state table?

They hold the same information. The diagram shows states as nodes and transitions as arrows, which is easier to read. The table lists every state against every event, which makes the invalid combinations visible as empty cells.

What is 0-switch and 1-switch coverage?

0-switch coverage exercises every single valid transition once. 1-switch coverage exercises every sequence of two consecutive transitions, which finds defects that depend on how a state was reached.

How many test cases does state transition testing need?

For valid transitions coverage, one per transition. All transitions coverage adds one per invalid state and event pair, which is the number of states times the number of events, minus the valid transitions.

How do I draw the state transition diagram?

Use "Copy as Mermaid" and paste the result into any Mermaid editor, such as mermaid.live, or into documentation that renders Mermaid, including GitHub and GitLab markdown.

Is my model sent to QAble?

No. Everything is calculated in your browser.

Need the edge cases found for you?

QAble testers work through the inputs, payment paths and data that break products in production, before your users find them.

Talk to QA Advisor