Skip to content

docs: restructure README as a progressive tutorial - #7

Merged
jacoelho merged 1 commit into
mainfrom
docs/readme-tutorial
Nov 10, 2026
Merged

jacoelho merged 1 commit into
mainfrom
docs/readme-tutorial

Conversation

@jacoelho

Copy link
Copy Markdown
Owner

What changes

The README becomes a tutorial that grows one cart example by one construct per step, followed by a reference section:

  1. Write a first scenario
  2. Reuse steps (And/But, Compose)
  3. Share setup with Background and Before
  4. Group scenarios with Rule
  5. Run one scenario per row with Outline
  6. Tag and select scenarios
  7. Skip scenarios or mark them pending
  8. Run scenarios in parallel

Reference: declaration order, chains, setup and lifecycle, failure output, names and tags. The migration section and the architecture link are unchanged.

Documentation only; no Go file changes.

Why

The previous README opened with one example and then went straight to a signature block and rules. A reader had no path from the first scenario to the other constructs.

Decisions a reviewer may question

  • Declaration order is a commented code skeleton, not the * / + / [ ] grammar notation and not a Mermaid diagram. The order is linear, so a diagram adds little, and Mermaid renders only on GitHub. The package doc keeps the compact notation.
  • The "Public API" signature block is removed. The intro points to go doc github.com/jacoelho/bdd; the block duplicated the signatures.
  • The structured-data snippet (priceRow, JSON) became one sentence in step 2.

Verification

Run locally on Go 1.27.3, darwin/arm64:

  • The 11 tutorial and reference Go blocks, concatenated in README order into one file in a scratch module that replaces the dependency with this checkout, pass gofmt -l, go vet and go test.
  • Every generated test path and both output listings in the README were copied from that run.
  • Both go test -run selectors in step 6 select what the text says; go doc github.com/jacoelho/bdd works.
  • All in-page anchors resolve to a heading.

Not compiled: six fragments (the "declare on r, not f" snippet and the five migration before/after snippets).

Limitation

Line numbers in the output listings (cart_test.go:33, :167) match only when the blocks are pasted in order.

The README now grows one cart example by one construct per step (first
scenario, reusable steps, Background and Before, Rule, Outline, tags,
Skip and Pending, Parallel), followed by a reference section.

The declaration order is shown as a commented code skeleton instead of
the grammar notation. The signature block is replaced by a pointer to
go doc. The migration section is unchanged.
@jacoelho
jacoelho merged commit 5a0755e into main Nov 10, 2026
1 check passed
@jacoelho
jacoelho deleted the docs/readme-tutorial branch November 10, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant