Behaviour Driven Development (BDD) is an agile approach to delivering software that has been around for well over a decade. It was created to help developers care about quality, morphed into a collaboration approach, and found widespread mis-adoption as a test automation technique.
In this session Seb will explain how BDD is intended to work, what value it delivers when done well, and why much BDD in the workplace falls short.
Learning Objectives:
What can our attendees expect to take away from the session?
● enumerate the three core practices of BDD
● explain the difference between BDD and test automation
● argue that collaboration and learning are at the heart of successful software development
3. @sebrose seb.rose@smartbear.com
Behaviour Driven Development
“An approach that enhances the
communication between
stakeholders and project team
members by expressing product
needs as concrete examples.”
Agile Extension to IIBA BABOK ®
4. @sebrose seb.rose@smartbear.com
“BDD helps close the gap between
business people and technical people by:
• building a shared understanding
• working in rapid, small iterations
• automatically checking the
documentation is correct”
https:/
/cucumber.io/docs/bdd/
5. @sebrose seb.rose@smartbear.com
The three practices of BDD
| Examples of system behaviour are documented
using business terminology
| The documentation is automated, creating living
documentation that verifies the system’s behaviour
| Create a shared understanding of the requirements
through collaboration, typically achieved through a
structured conversation centered on rules and
examples
https://cucumber.io/docs/bdd/
Proprietary & Confidential
BDD approach
8. @sebrose seb.rose@smartbear.com
Let’s talk about
requirements
Have
you thought
about …
Isn’t
there something
else that needs to
happen?
Is that
always
What would
happen if … ?
9. @sebrose seb.rose@smartbear.com
Let’s talk about
requirements
Give me an
example.
Have
you thought
about …
Isn’t
there something
else that needs to
happen?
Is that
always
What would
happen if … ?
15. @sebrose seb.rose@smartbear.com
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
16. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
17. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Andrew reserves a book
He is charged £1
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
18. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Andrew reserves a book
He is charged £1
Andrew reserves two books
He is charged £1
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
19. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Andrew reserves a book
He is charged £1
Andrew reserves two books
He is charged £1
£1 £2
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
20. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Andrew reserves a book
He is charged £1
Andrew reserves two books
He is charged £1
£1 £2
per item
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
21. @sebrose seb.rose@smartbear.com
Apply reservation charges to
library members
Members pay a reservation
charge of £1
Andrew reserves a book
He is charged £1
Andrew reserves two books
He is charged £1
£1 £2
per item
Is there a limit to
the number of
books that can be
reserved?
Reserving a book at the library
At the library, it’s free to take out books that are on the shelves,
but there is a charge of £1.00 if you want to reserve an item
that’s currently out on loan.
40. @sebrose seb.rose@smartbear.com
Andrew is a library member
Context
Action
Outcome
Andrew reserves one book
Andrew is charged £1.00
Library members pay a
reservation charge of £1 per item
Anatomy of
an example
54. @sebrose seb.rose@smartbear.com
Given that Andrew has adult membership
- Andrew is an adult member
- Andrew is an adult member
* Andrew reserves a book
Formulation
Given that Andrew has adult membership
When he reserves 1 book
55. @sebrose seb.rose@smartbear.com
Given that Andrew has adult membership
- Andrew is an adult member
- Andrew is an adult member
* Andrew reserves a book
Formulation
- Andrew is an adult member
* Andrew reserves a book
=> The charge is £1
Given that Andrew has adult membership
When he reserves 1 book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
56. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
57. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
58. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
- use concrete data for clarity
59. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
- use concrete data for clarity
- reveal intent, don’t describe mechanics
60. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
- use concrete data for clarity
- reveal intent, don’t describe mechanics
- remove incidental details
61. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
- use concrete data for clarity
- reveal intent, don’t describe mechanics
- remove incidental details
- each scenario illustrates a single rule
62. @sebrose seb.rose@smartbear.com
Good scenarios should be BRIEF:
• Business readable
• Real data
• Intention revealing
• Essential
• Focused
• BRIEF
- terminology drawn from business domain
https://cucumber.io/blog/bdd/keep-your-scenarios-brief-(1)/
- use concrete data for clarity
- reveal intent, don’t describe mechanics
- remove incidental details
- each scenario illustrates a single rule
- keep scenarios short (less than 6 steps)
67. @sebrose seb.rose@smartbear.com
Automation
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
68. @sebrose seb.rose@smartbear.com
Automation
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
69. @sebrose seb.rose@smartbear.com
Automation
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
Scenario: Andrew reserves a book
Given that Andrew has adult membership
When he reserves 1 book
Then he should be charged £1
Scenario: Andrew reserves a children’s book
Given that Andrew has adult membership
When he reserves 1 children’s book
Then he should be charged £1
Expected ‘1.00’, but received ‘0.00’
72. @sebrose seb.rose@smartbear.com
Living documentation
Living documentation automatically tells you when it
diverges from the system it documents.
Divergence has several causes:
• Specified functionality is still to be implemented
• Documentation is incorrect/out-of-date
73. @sebrose seb.rose@smartbear.com
Living documentation
Living documentation automatically tells you when it
diverges from the system it documents.
Divergence has several causes:
• Specified functionality is still to be implemented
• Documentation is incorrect/out-of-date
• Defect has been introduced into the system
76. @sebrose seb.rose@smartbear.com
ROI of Discovery
https://code.joejag.com/2018/lego-workstream-visualisation.html
Planned Failure Ad-hoc Meetings
Apr 23% 30% 40% 2%
Nov 56% 4% 24% 10%
We had more than doubled the time spent on planned work by banishing
failure demand.
[An] interesting thing to note was that we spent five times more time in
meetings. Spending an hour getting feedback was saving a day
developing the wrong feature.
77. @sebrose seb.rose@smartbear.com
ROI of Formulation
Problem
domain
SoluJon
domain
Ubiquitous
language
“A language structured around the domain model and used by all team
members to connect all the activities of the team with the software.”
Eric Evans, Domain-Driven Design
https://www.amazon.co.uk/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215
80. @sebrose seb.rose@smartbear.com
ROI of Automation
• Automated tests that guide development.
• Reliable documentation that automatically informs the
team when it is incorrect or out-of-date.
81. @sebrose seb.rose@smartbear.com
ROI of Automation
• Automated tests that guide development.
• Reliable documentation that automatically informs the
team when it is incorrect or out-of-date.
• A business-focused safety net for the entire lifetime of
the system.
90. @sebrose seb.rose@smartbear.com
BDD is
collaborative
Concrete examples
build a shared
understanding
Collaborative
discovery is
NOT optional
Automation
creates living
documentation
BDD is NOT
technical
Documentation
must be business
readable
… reviewed
(NOT written)
by business
91. @sebrose seb.rose@smartbear.com
BDD is
collaborative
Concrete examples
build a shared
understanding
Collaborative
discovery is
NOT optional
Automation
creates living
documentation
Test
automation is
not the goal
BDD is NOT
technical
Documentation
must be business
readable
… reviewed
(NOT written)
by business