Skip to content

Recipes

Every recipe shows one scenario twice: the test you write, and the documentation it generates. Pick your framework in the tab strip on any recipe and the rest of the site follows that choice.

How Given, When, and Then read when you repeat them. A repeated keyword renders as And from the second occurrence onward.

story.and() and story.but() never auto-convert, so use them when the wording matters more than the keyword arithmetic.

Tables, JSON, and code blocks travel with the step they belong to, so a reader sees the payload rather than a description of it.

Loop over your cases and register one scenario per row. No Examples table, no placeholder syntax, just the language you already write.

Each snippet is lifted from a suite that runs in CI, so none of it drifts:

Adapter Source
Vitest apps/vitest-example/src/replicate.story.test.ts
Jest apps/jest-example
Playwright apps/playwright-example
Cypress apps/cypress-example
Go, Python, Rust, Kotlin, C# packages/executable-stories-*

For the full API behind these recipes, see the story and doc API reference.