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…

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-008  Invalid: "ship" while in New             negative

stateDiagram-v2
  [*] --> New
  New --> Paid: pay
  Paid --> Shipped: ship

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.