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.
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 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 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.
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.
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 Terms
Explore related glossary terms to deepen your understanding.
Related Resources
Dive deeper with these related interview prep pages.
Free QA career tools, no account needed
Instant and private, everything runs in your browser. Try them before you sign up.
QA Resume Checker
Instant 0-100 score on automation keywords, impact, and ATS formatting.
QA Cover Letter Generator
A tailored 3-paragraph QA cover letter from your resume and a job post.
QA Application Tracker
Drag-and-drop kanban to track every QA application from Applied to Offer.
QA Take-Home Test Generator
A realistic take-home assignment with a scenario, tasks, and a rubric.
QA LinkedIn Headline Generator
A recruiter-searchable headline, About section, and skills list.
QA STAR Story Builder
Structure a QA behavioral answer with the STAR method and instant checks.
QA Bug Report Generator
Build a clean, reproducible bug report for Markdown, Jira, or plain text.
Boundary Value Analysis Generator
Generate boundary value and equivalence partitioning test cases from a range.
QA Metrics Calculator
Calculate DRE, defect leakage, defect density, and pass rate with interpretation.
QA Test Plan Generator
Build a structured test plan (scope, approach, criteria, risks) in Markdown.
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