Skip to content

Recipes (Rust)

8 representative recipes showing key BDD patterns with Rust. The generated output is identical across all frameworks — only the test code differs.

AspectVitestRust
Importimport { story } from 'executable-stories-vitest'use executable_stories::Story;
Initstory.init(task)let mut s = Story::new("scenario name");
Test functionit("name", ({ task }) => { ... })#[test] fn test_name() { ... }
Stepsstory.given(...)s.given(...)
Tagsstory.init(task, { tags: ["t1"] })Story::new("name").with_tags(&["t1"])
Finish(automatic)s.pass() must be called at the end
ScenarioPattern
User logs in successfullyMultiple Given (And auto-conversion)
Login worksStory with tags
Login blocked for suspended userUse of But
Checkout calculates totalsMultiple Then
Bulk user creationdoc.table
API accepts JSON payloaddoc.json
Import XML invoicedoc.code
Create orderBackground and tags

For the full 32-scenario set, see the Vitest recipes.