Skip to main content
Strategy & Process
DEFINITION

What is Specification by Example?

Specification by example (SBE) is a collaborative approach to defining requirements using concrete, realistic examples of system behavior, which are refined into executable acceptance tests that double as always-current, living documentation.

Free to start · 7-day trial on paid plans

IN DEPTH

In depth.

Abstract requirements ("the system should handle discounts") are easy to misinterpret. Specification by example replaces or augments them with concrete cases ("a 10% discount on a $50 order gives $45; an expired coupon is rejected"). Concrete examples force clarity, expose disagreements, and are far harder to misunderstand than prose. The team collaborates (often via the three amigos) to derive key examples that capture the important behaviors and edge cases.

Those examples are then automated as acceptance tests, so the specification becomes executable: running the tests proves the system still matches the agreed examples. Because the tests are tied to the examples and kept passing, they form living documentation that never drifts out of date the way written specs do, if the behavior changes, the test (and thus the documentation) must change with it.

Specification by example is the conceptual backbone of BDD and ATDD. BDD provides the Given-When-Then language to express the examples; ATDD emphasizes agreeing them before development. SBE is the broader principle: drive shared understanding and verification from concrete, agreed examples rather than ambiguous descriptions.

WHY IT MATTERS

Why interviewers ask about this.

Specification by example connects requirements, collaboration, testing, and documentation, a holistic view interviewers value. Explaining how concrete examples become executable acceptance tests and living documentation shows you understand modern, communication-driven quality practices.

EXAMPLE

Example scenario.

For a shipping-cost feature, the team agrees on examples: orders over $50 ship free; under $50 cost $5; international adds $15. These become automated acceptance tests. Months later, when free shipping changes to $75, the test must be updated, so the executable specification and its documentation stay accurate by construction.

TIP

Interview tip.

Define specification by example as defining requirements through concrete, agreed examples that become executable acceptance tests and living documentation. Tie it to BDD (the language) and ATDD (agreeing before dev), and stress the killer benefit: documentation that cannot silently go stale because it is executable.

FAQ

Frequently asked questions.

How is specification by example related to BDD?

Specification by example is the broader principle of driving shared understanding and verification from concrete, agreed examples. BDD is a way to do it: it provides the Given-When-Then language to express those examples as scenarios. SBE is the philosophy; BDD is a popular implementation of it.

What is "living documentation"?

Living documentation is documentation that stays accurate because it is executable. When acceptance tests are derived from agreed examples and kept passing, they describe how the system actually behaves, and any behavior change forces a test (documentation) update, so it never silently drifts out of date like static written specs.

Related Resources

Dive deeper with these related interview prep pages.

FREE TOOLS  /  no signup

Free QA career tools, no account needed

Instant and private, everything runs in your browser. Try them before you sign up.

EXEC.NOW

Ready to Ace Your QA Interview?

Practice explaining specification by example and other key concepts with our AI interviewer.

Join 1,200+ QA engineers already practicing with AssertHired.

Start your free QA interview
FREE.TO.START  ·  7.DAY.TRIAL ON PAID PLANS
Written by Aston Cook, Senior QA EngineerLast updated May 2026