Share
Embed
Demystifying BDD
Paul van der Slot
June 09, 2026
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
86 slides
-
Paul van der Slot Freelance Hands-on Software Architect - Domain-Driven
Design & Collaborative Modelling Enthusiast Currently working for Alliander as a Business Architect -
1999 Software Engineering practice - Write automated tests defining desired
behavior before writing the actual code. - Very often misunderstood, or implemented poorly. Kent Beck Test Driven Development -
Domain Driven Design 2003 Eric Evans BLOG: Domain-Driven Design in
2020 Approach to software development with in its core these elements: • Focus on learning Alberto Brandolini -
Domain Driven Design 2003 Eric Evans BLOG: Domain-Driven Design in
2020 Approach to software development with in its core these elements: • Focus on learning • Language as a first class citizen Alberto Brandolini -
Domain Driven Design 2003 Eric Evans BLOG: Domain-Driven Design in
2020 Approach to software development with in its core these elements: • Focus on learning • Language as a first class citizen • Multiple models is the key for not evolving into a big ball of mud. Alberto Brandolini -
Domain Driven Design 2003 Eric Evans BLOG: Domain-Driven Design in
2020 Approach to software development with in its core these elements: • Focus on learning • Language as a first class citizen • Multiple models is the key for not evolving into a big ball of mud. • Good coding practices are expected Alberto Brandolini -
Domain Driven Design 2003 Eric Evans BLOG: Domain-Driven Design in
2020 Approach to software development with in its core these elements: • Focus on learning • Language as a first class citizen • Multiple models is the key for not evolving into a big ball of mud. • Good coding practices are expected • Know your core domain Alberto Brandolini -
Domain Driven Design 2003 Eric Evans Designing software that resembles
the problem domain. Benefits: - Bridging the Business and IT gap - Managing the complexity of software - Creating maintainable software systems, that are easy to understand and change -
Domain Driven Design 2003 Eric Evans Designing software that resembles
the problem domain. Benefits: - Bridging the Business and IT gap - Managing the complexity of software - Creating maintainable software systems, that are easy to understand and change Highly Recommended -
“it must be possible to present TDD in a way
that gets straight to the good stuff (…) My response is behaviour-driven development (BDD).” Dan North; Introducing BDD Blog -
“it must be possible to present TDD in a way
that gets straight to the good stuff (…) My response is behaviour-driven development (BDD).” “It has evolved out of established agile practices and is designed to make them more accessible and effective (…) Over time, BDD has grown to encompass the wider picture of agile analysis and automated acceptance testing.” Dan North; Introducing BDD Blog -
It must be stressed that BDD is a rephrasing of
existing good practice, it is not a radically new departure. Its aim is to bring together existing, well-established techniques under a common banner and with a consistent and unambiguous terminology. -
Most important Themes of BDD Behavior first! Shared uniform Language
Users’ Perspective Acceptance criteria & Scenario’s Executable Specifications Documentation -
"If I had an hour to solve a problem I
would spend the first 55 minutes thinking about the problem and 5 minutes thinking about solutions." Einstein -
How can you create a solution when you don’t know
what you are solving? -
1. Focus on Business Value 2. Behavior is relevant for
(and can be understood by) both Business and IT Why behavior first? -
1. Focus on Business Value 2. Behavior is relevant for
(and can be understood by) both Business and IT 3. The Behavior can be seen as the stable specifications of the system. The contract of how the system should behave to its users. Why behavior first? -
To describe clearly what our systems needs to do, we
need to collaborate and create a shared understanding. Shared uniform Language Domain expert Product Owner User Developer Tester Business Analyst -
This is a shared language of the ‘Business Domain’, Building
a common, rigorous language between software team and the users/experts. • So focus on a shared vocabulary with clear meaning DDD – Ubiquitous Language* *Comes from the Latin word ubique, meaning "everywhere". -
This is a shared language of the ‘Business Domain’, Building
a common, rigorous language between software team and the users/experts. • So focus on a shared vocabulary with clear meaning Not only words, but also about relationships. The Business and IT people should have a shared understanding of the domain model. • Focus on the model, how is all related DDD – Ubiquitous Language* *Comes from the Latin word ubique, meaning "everywhere". -
Ubiquitous Language Domain expert Developer Business Analyst Cargo Shipping and
Itinerary Database Shipment Shipment -
Ubiquitous Language – vocabulary Domain expert Developer Business Analyst Cargo
Shipment Itinerary Account User Account Buy Order -
Ubiquitous Language Ubiquitous Language Scrum Team Code (Test) Scenarios User
Stories Domain experts -
Ubiquitous Language Ubiquitous Language Scrum Team Code (Test) Scenarios User
Stories Domain experts specific for a domain -
When the system is divided by clear domains, and teams
are assigned to those domains, teams are as independent as possible (bounded context, DDD). When teams are responsible for a domain, they can own and evolve the ubiquitous language of that domain. Teams aligning around problem domains -
Describe the (desired) behavior of the system (aka the requirements)
from a users’ perspective. Focus on what needs to happen, not on how it should happen. Users’ Perspective -
https://www.justinmind.com/blog/examples-user-story-best-practices/ Written in the Ubiquitous Language! Can you spot which
part focusses too much on solution, and not the problem? -
https://www.justinmind.com/blog/examples-user-story-best-practices/ Written in the Ubiquitous Language! Can you spot which
part focusses too much on solution, and not the problem? -
Requirements, IEEE definition: A condition or capability needed by a
user to solve a problem or achieve an objective User stories are Requirements Story As a User, I want some Behavior, so that I can achieve some benefit -
Requirements, IEEE definition: A condition or capability needed by a
user to solve a problem or achieve an objective User stories are Requirements Story As a User, I want some Behavior, so that I can achieve some benefit Stable requirements when user stories and acceptance criteria are focussed on “the problem domain” -
As the system, I need to upgrade to AWS Serverless
to handle traffic spikes Bad User Story Examples -
As the system, I need to upgrade to AWS Serverless
to handle traffic spikes - Doesn’t have the view of a user - Focussed on solutions - What is the problem behind the traffic spikes? Better Alternative: As a user, I want the website to load quickly even during Black Friday so that I can shop without interruption Bad User Story Examples -
As a Product Manager, I want to add a pop-up
advertisement on the checkout page, to increase ad revenue. Bad User Story Examples -
As a Product Manager, I want to add a pop-up
advertisement on the checkout page, to increase ad revenue. - Doesn’t describe what to user gains / the added value is - This actively degrades the user experience to benefit the business. Better Alternative: As a shopper, I want to see relevant product recommendations during checkout, so I can discover items I might like. Bad User Story Examples -
• Clear scope of the work / Agreed verifiable result
• Described in Ubiquitous Language Acceptance criteria and scenarios -
Acceptance criteria are a set of rules which cover aspects
of a system’s behavior, and from which scenarios can be derived. A scenario is an example of the system’s behavior from one or more users’ perspectives. Acceptance criteria and Scenarios https://lizkeogh.com/2011/06/20/acceptance-criteria-vs-scenarios/ Liz Keogh -
Acceptance criteria: Scenario: Acceptance criteria and Scenarios we can’t sell
baby animals younger than their recommended selling age Given a rabbit called Fluffy who is 1 1/2 months old And the recommended selling age for rabbits is 6 months old When we try to sell Fluffy Then we should be told Fluffy is too young. -
Another example Acceptance Criteria (The Rules) • The discount code
must be alphanumeric and exactly 6 characters. • A single code can only be used once per customer. • If the code is expired, it cannot be used. Scenarios (Concrete Examples) Given the user is checking out, When the user applies a valid discount code, Then the discount value should be subtracted from the total Given the user is checking out, When the user applies an expired discount code, Then the user should be notified it is expired. -
WATCH OUT: scenarios in the language of the problem domain,
decoupled from implementation Otherwise they are too tightly coupled to your implementation, and you have to change them over and over. -
WATCH OUT: scenarios in the language of the problem domain,
decoupled from implementation Otherwise they are too tightly coupled to your implementation, and you have to change them over and over. Given the user is checking out, When the user applies an expired discount code, Then the user should be notified it is expired. VS Given the user is on the checkout page, And the user enters an expired discount code in the discount field, When the user clicks apply, Then the the error message “This code is expired”, should be displayed -
WATCH OUT: scenarios in the language of the problem domain,
decoupled from implementation Otherwise they are too tightly coupled to your implementation, and you have to change them over and over. Given the user is checking out, When the user applies an expired discount code, Then the user should be notified it is expired. VS Given the user is on the checkout page, And the user enters an expired discount code in the discount field, When the user clicks apply, Then the the error message “This code is expired”, should be displayed Focus on the goal Instantly readable Hides implementation details Reduces maintainance Test case is always true -
“Talking through scenarios is, for me, the most important aspect
of BDD. That’s how we discover whether we have a shared understanding or not; by using specific examples to illustrate our understanding or discover our ignorance.” Importance of concrete scenario’s Liz Keogh -
“Talking through scenarios is, for me, the most important aspect
of BDD. That’s how we discover whether we have a shared understanding or not; by using specific examples to illustrate our understanding or discover our ignorance.” “When we’re discussing the scenarios, it isn’t always necessary to write scenarios for all the acceptance criteria. As long as the acceptance criteria are clear enough to derive the relevant scenarios easily, I recommend leaving it as acceptance criteria until the point where it needs to be automated.” Importance of concrete scenario’s Liz Keogh -
Stressing and improving a Domain Model by Scenario’s and Code
(in that order) DDD Whirlpool -
• Acceptance criteria that indicate agreed upon constraints about the
scope of the story • Examples that can lead to acceptance tests. • Questions about scenarios where your team isn’t clear on expected behavior. • Assumptions you’re making in order to move forward • New backlog items that you discover as a result of the discussion or sliced off and deferred from delivery. -
Formulate concrete scenarios Automate those scenarios as a test Create
the solution, so the automated test passes Executable Specifications Driving implementations -
Example of a scenario @ DSO, Planning of Trains Ideal
day -> Ideal week Quite complex: Scenarios ready and confirmed with the business before we started building During sprint: Automate scenario first, then build -
Given this ideal day When we extrapolate it to an
ideal week Then the end of that ideal week should look like this -
Given this ideal day When we extrapolate it to an
ideal week Then the end of that ideal week should look like this -
Example of a scenario @ Alliander Bodemonderzoek Even when you
don’t follow an all-in BDD process, you can benefit from this thinking. Used BDD mindset as a developer to create software that is easy to use by other software If it is difficult to write a test, your software is hard to use. (and design is bad) Write the test first: Forces you to think first from a users perspective, before writing code -
Example of a scenario @ Alliander Bodemonderzoek Tests formulated in
globally this way: Given a bodemonderzoek is started by consumer When the bodemonderzoek is completed Then consumer is notified that the bodemonderzoek is completed And the the document is saved correctly -
User stories -> Scenarios as Executable Specifications (tests) Group you
Test Scenarios by functionality in a separate test file • Reveals the why of a system • Documentation for new team members • Always later extractable Documentation -
Creating Scenarios as Automated Tests All Scenarios (old and new)
should be working as a “Definition of Done”. So even when you don’t automate these tests before you start developing, they have a lot of value! Regression tests -
Value of understanding the domain/problem "SV-like" companies think of engineers
as value generators, and creative problem solvers. Traditional companies think of them as factory workers. - Gergely Orosz -
Value of understanding the domain/problem Learning is the constraint! Dan
North https://dannorth.net/introducing-deliberate-discovery/ -
New employees Understand the system faster because of all the
scenarios and specifications that are available BDD provides context and understanding -
Technical migrations Scenarios and behavior that is decoupled from the
implementation. Test suite is still intact. Understanding the legacy system becomes easier. BDD provides context and understanding -
AI / LLMs Vibe coding is great for quick prototyping,
setting up projects or creating build pipelines, but not for durable software development. LLM benefit from more context. Using Scenarios as Specifications, creates more focussed instructions to the LLM, with test cases as constraints. This enables a more spec-driven development approach, instead of pure vibe coding. https://www.scalablepath.com/ai/spec-driven-development-guide BDD provides context and understanding -
Mindset over Tools Behavior first! Shared uniform Language Users’ Perspective
Acceptance criteria & Scenario’s Executable Specifications Documentation -
CREDITS: This presentation template was created by Slidesgo, including icons
by Flaticon, infographics & images by Freepik THANK YOU ! Do you have any questions? Come talk to me, or reach out on LinkedIn! Paul van der Slot