Skip to content

Installation (Go)

Terminal window
go get github.com/jagreehal/executable-stories/packages/executable-stories-go

Require Go 1.22 or later.

Add a TestMain function to each test package that should produce a report. RunAndReport runs the tests and writes the raw run JSON before exiting:

package mypackage_test
import (
"os"
"testing"
es "github.com/jagreehal/executable-stories/packages/executable-stories-go"
)
func TestMain(m *testing.M) {
os.Exit(es.RunAndReport(m))
}

RunAndReport writes .executable-stories/raw-run.json by default. Set the EXECUTABLE_STORIES_OUTPUT environment variable to write to a different path.

Pass the raw run JSON to executable-stories-formatters to render Markdown, HTML, JUnit XML, or Cucumber formats:

Terminal window
npx executable-stories-formatters format --input .executable-stories/raw-run.json --format markdown

Install the formatters package once in your Node project or CI job:

Terminal window
npm install -D executable-stories-formatters

First Story (Go) — write your first Go scenario.

Go story & doc API — steps, docs, and adapter options.