Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Demystifying BDD

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Demystifying BDD

Avatar for Paul van der Slot

Paul van der Slot

June 09, 2026

More Decks by Paul van der Slot

Other Decks in Technology

Transcript

  1. Paul van der Slot Freelance Hands-on Software Architect - Domain-Driven

    Design & Collaborative Modelling Enthusiast Currently working for Alliander as a Business Architect
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. “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
  11. “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
  12. 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.
  13. Most important Themes of BDD Behavior first! Shared uniform Language

    Users’ Perspective Acceptance criteria & Scenario’s Executable Specifications Documentation
  14. "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
  15. 1. Focus on Business Value 2. Behavior is relevant for

    (and can be understood by) both Business and IT Why behavior first?
  16. 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?
  17. 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
  18. 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".
  19. 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".
  20. 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
  21. 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
  22. 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
  23. 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”
  24. As the system, I need to upgrade to AWS Serverless

    to handle traffic spikes Bad User Story Examples
  25. 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
  26. As a Product Manager, I want to add a pop-up

    advertisement on the checkout page, to increase ad revenue. Bad User Story Examples
  27. 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
  28. • Clear scope of the work / Agreed verifiable result

    • Described in Ubiquitous Language Acceptance criteria and scenarios
  29. 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
  30. 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.
  31. 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.
  32. 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.
  33. 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
  34. 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
  35. “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
  36. “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
  37. • 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.
  38. Formulate concrete scenarios Automate those scenarios as a test Create

    the solution, so the automated test passes Executable Specifications Driving implementations
  39. 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
  40. Given this ideal day When we extrapolate it to an

    ideal week Then the end of that ideal week should look like this
  41. Given this ideal day When we extrapolate it to an

    ideal week Then the end of that ideal week should look like this
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. Value of understanding the domain/problem Learning is the constraint! Dan

    North https://dannorth.net/introducing-deliberate-discovery/
  48. New employees Understand the system faster because of all the

    scenarios and specifications that are available BDD provides context and understanding
  49. 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
  50. 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
  51. Mindset over Tools Behavior first! Shared uniform Language Users’ Perspective

    Acceptance criteria & Scenario’s Executable Specifications Documentation
  52. 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