State Transition Generator

Runs in browser Test Design

Model a workflow (e.g. order: new → paid → shipped) and produce a state table, transition-coverage test cases and negative (invalid-transition) tests with a Mermaid diagram.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

What are black-box test design techniques?

Black-box techniques derive test cases from the specification without reading the code: equivalence partitioning groups inputs that should behave the same, boundary value analysis tests the edges of each group (0, 1, max, max+1), decision tables enumerate combinations of conditions, state transition testing walks the allowed and forbidden state changes, and pairwise testing covers every pair of parameter values with far fewer cases than the full product.

Read the guide: How to Write Test Cases

How to use State Transition Generator

  1. Write one transition per line; the first state is the initial state.
  2. Choose 0-switch or 1-switch coverage and whether to include invalid-transition tests.
  3. Generate to get the state table, Mermaid diagram and test cases.

State Transition Generator features

  • Transitions as "State --event--> State" with optional guards
  • State × event table showing valid targets and invalid combinations
  • 0-switch and 1-switch coverage test cases
  • Negative tests for every invalid transition
  • Unreachable-state and missing-final-state warnings
  • Mermaid stateDiagram-v2 text for documentation

State Transition Generator example

Order workflow

Input:

New --pay--> Paid
Paid --ship--> Shipped
Shipped --deliver--> Delivered
New --cancel--> Cancelled

Output:

ST-001  New —pay→ Paid                          positive
ST-005  New —pay→ Paid —ship→ Shipped           positive (1-switch)
ST-007  Invalid: "ship" while in New             negative

stateDiagram-v2
  [*] --> New
  New --> Paid: pay
  Paid --> Shipped: ship
The order workflow as a diagram: 0-switch coverage tests each arrow once, and 1-switch tests each pair of consecutive arrows.
Transitions
#FromToEvent · 0-switch test
1NewStartPaidpay · ST-001
2PaidShippedship · ST-002
3ShippedDeliveredEnddeliver · ST-003
4NewStartCancelledEndcancel · ST-004

With the tool's defaults, 1-switch adds ST-005 New → Paid → Shipped and ST-006 Paid → Shipped → Delivered; the 16 state × event combinations with no arrow are invalid-transition tests, from ST-007.

Frequently asked questions about State Transition Generator

How do I write transitions?

One per line as "State --event--> State". Guards go in brackets ("Delivered --return [within 14 days]--> Returned"). The first state mentioned is the initial state.

What is 0-switch and 1-switch coverage?

0-switch tests every single transition. 1-switch tests every valid pair of consecutive transitions, which finds bugs that only show up after a particular sequence.

What are invalid-transition tests?

For every state × event combination without a defined transition, a negative test checks the event is rejected and the state does not change — the most common source of workflow bugs.

What can I do with the Mermaid diagram?

Paste it into GitHub, GitLab, Notion, Obsidian or mermaid.live to render the state diagram for reviews and documentation.

References