Skip to content

Recipes (Go)

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

AspectVitestGo
Importimport { story } from 'executable-stories-vitest'import es "github.com/jagreehal/executable-stories/packages/executable-stories-go"
Initstory.init(task)s := es.Init(t, "scenario name")
Test functionit("name", ({ task }) => { ... })func TestName(t *testing.T) { ... }
Stepsstory.given(...)s.Given(...)
Tagsstory.init(task, { tags: ["t1"] })es.Init(t, "name", es.WithTags("t1"))
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.