Skip to content
Version: XState v5

Generate test paths

You can generate test path code for your state machines from the Tests panel, which you can use to implement tests in your code. Both setup code and test code for each path are generated.

This feature is in beta and we’d love your feedback.

Path generation strategy​

You can choose between two path generation strategies:

  • Shortest path: Generate paths that cover the shortest possible paths through your state machine and minimize the number of actions required to test functionality.
  • Simplest path: Generate paths that cover the simple paths, without repeated states, through your state machine and help verify that basic functionality is working as expected.

Testing frameworks​

Generate test paths currently supports Playwright and custom testing framework formats. We plan to add more testing frameworks (including Puppeteer, Cypress, and even other languages) in the future.

Options​

  • Reduce duplicate paths generates fewer paths that also cover other paths.
  • Prefer transition coverage generates paths that cover all transitions in your state machine.
  • Highlight paths enables highlighting the paths on the canvas when you hover over its test path description.
  • AI-generated test titles (experimental) generates more readable test titles based on your state machine. AI-generated test titles send your state machine to OpenAI to generate the titles.