methodatlas
RunsheetAgile

Specification by Example

ComplexityMedium
Time60-90 min pro Feature
Participants3-6
FormatWorkshop
MaturityCanonical
01

Prerequisite

What needs to be finished first

Complete firstThree Amigos

Business, testing and engineering collaborate in refinement or can be brought together for the workshop.

Without: Without all three perspectives, examples emerge that later cannot be executed technically or from a domain perspective.
02

Preparation

What needs to be ready before start

Materials

Shared document or Confluence page with table structure; story or feature description; known rule sets from domain; examples from previous executable specifications; test framework reference (Gherkin, Cucumber, SpecFlow).

People / roles

One facilitator (tester or BA); Product Owner or domain expert; engineer with implementation knowledge; optional tester for edge-case search.

Pre-read

Story description with acceptance criteria; existing business rules (for example from docs, legal texts); domain glossary; list of known special cases.

Time needed

60-90 min per feature

Setup

One section per story in the document. Table with columns rule, example input, expected output, note. Gherkin template as optional structure. Glossary visible.

03

Core question

The one question this method answers

Which concrete examples describe the business logic unambiguously enough to serve as executable tests?

04

Flow

Marker: Phase

StepDurationActionHint
1Phase 1: Clarify story and rules
10-15 minPresent story or feature. Name 1-5 rules per story that describe the logic (for example "discount from EUR 100 order value").If rules are not stable, the story is not ready for Specification by Example. Negotiate rules with PO first, then examples.
2Phase 2: Happy-path examples
15-20 minFormulate at least one happy-path example per rule: concrete input values, expected output. Examples in table or Given-When-Then.Choose meaningful values (for example EUR 99.99, EUR 100.00, EUR 100.01 instead of only 50, 100, 200). Meaningless values hide boundaries.
3Phase 3: Boundaries and edge cases
15-25 minActively search boundaries: null values, maximum values, empty lists, invalid inputs, parallel conditions. One example per edge case.Testers drive this phase. If no edge cases are found, the story was understood too superficially. Boundary search is the method's core.
4Phase 4: Hand examples over as acceptance tests
10-15 minConvert examples into test-framework format (Gherkin, JSON, CSV). Engineering implements tests before code. Tester reviews coverage.If examples are not automatable, the step was cut short. Gold standard: examples become executable acceptance tests. Manual tests are a valid fallback.
05

Artifact

What comes out at the end

Form

Example table or Gherkin feature file in repo, linked to story in ticket system. Glossary in wiki. Automated tests in test directory referencing the examples.

Versioning / ownership

Examples in code repo, same branch as implementation. Rule changes via pull request, examples versioned together. Glossary versioned in wiki.

Tool alternatives
  • Cucumber or SpecFlow with Gherkin syntax
  • Robot Framework with keyword-driven tests
  • FitNesse with table specification
  • Concordion with Markdown-based specifications
  • Custom test framework with JSON/YAML example files

specification-by-example-working-template.md

Compact working template for Specification by Example with context, input, output artifacts, and next step.

Specification by Example Working Template

Goal

Concrete examples serve as an executable specification.

Context

When and for what do we use this method?

Input

Which data, observations, decisions, or materials are available?

Execution

Short notes along the runsheet.

Output artifacts

  • Example table:
  • Acceptance Tests:

Assumptions and open questions

  • ...

Decision / next step

Owner, date, and success signal.

06

Example output

Concrete filled scenario, fictional example

specification-by-example-beispiel.md

Concrete filled scenario, fictional example

Specification by Example - Client discount calculation, 2026-05-18

Story: As a tax advisor, I want to automatically receive a discount when my client count exceeds the tier.

Rules

  1. For 1-10 clients: 0% discount.
  2. For 11-50 clients: 10% discount on total price.
  3. For 51-100 clients: 20% discount.
  4. For >100 clients: 30% discount.

Examples (Gherkin)

Feature: Client discount calculation

  Scenario Outline: Discount by client count
    Given tax advisor Sabine has <Clients> active clients
    When the monthly price is calculated
    Then the discount is <Discount>% and the final price is <FinalPrice> EUR

    Examples:
      | Clients | Discount | FinalPrice |
      | 1       | 0        | 29.00      |
      | 10      | 0        | 29.00      |
      | 11      | 10       | 26.10      |
      | 50      | 10       | 26.10      |
      | 51      | 20       | 23.20      |
      | 100     | 20       | 23.20      |
      | 101     | 30       | 20.30      |
      | 500     | 30       | 20.30      |

Edge Cases

  • 0 clients -> EUR 0 final price (special rule: no active contract)?
  • Clients with status "paused" do not count (clarify with PO).
  • Transition during month (for example 10 to 11 clients on the 15th): discount recompute at month end.

Glossary updates: "Active client" = status "active" in table mandanten, not paused or deleted.

07

Pitfalls

Recognize symptoms and steer against them

Trap

Examples without edge cases

Symptom

Only happy-path examples, tests are green, but production edge cases cause bugs.

What to do

Tester actively drives edge-case search. At least 30% edge cases per story. Use checklist of typical edge patterns (null, max, empty, invalid).

Trap

Meaningless values

Symptom

Examples use 1, 10, 100 without relation to business rules, boundaries are not checked.

What to do

Choose values around boundaries (99.99, 100.00, 100.01). For each rule boundary, at least 3 values: before, on, after boundary.

Trap

Examples not automatable

Symptom

Examples describe UX behavior without clear input-output logic, tests remain manual.

What to do

Keep examples at logic level, not UI. If UI behavior is meant, define separate UI tests. Specification by Example is logic specification.

Trap

Workshop without all three roles

Symptom

Only PO and engineer present, tester missing. Edge cases remain untreated, coverage weak.

What to do

Enforce Three Amigos principle. If tester is unavailable, postpone workshop or add asynchronous tester review. Do not finalize without tester.

Trap

Examples alive, tests outdated

Symptom

Examples in wiki are maintained, test code in repo is not in sync, documentation drifts from reality.

What to do

Single source of truth: examples in code repo next to tests. Wiki examples only as generated output from test definitions.

08

Stop criteria

Done signals checkable in under a minute

Story is too vague, rules cannot be named stably.
Logic is primarily UI, examples cannot be captured as input-output tests.
No tester or test automation setup available, tests remain manual without value gain.
PO or domain expert unavailable, business rules would be guessed.
Story is very simple (1-2 trivial rules), workshop overhead outweighs value.
Team does not know Gherkin or comparable notation, learning curve is not feasible in sprint.

Finished the runsheet?

Go to the profile for purpose, similar methods, and sources or continue to the next method in the catalog.