John Ferguson Smart
BDD In Action Principles, practices and real-world applications
John Ferguson Smart
Consultant Trainer Mentor Author Speaker Coder
There are only two problems in software development
1) Building the software wrong
2) Building the wrong software
BDD
Feature InjectionAutomated Acceptance
Criteria
API and code design
Collaboration
Building the software right
Building the right software
Living Documentation
What is Behaviour Driven Development
Behaviour Driven Development is…
Conversa>on Focused
Story
bug reports
Working code boring
manual tes>ng
WASTEBA
Developer
Tester
Many teams build features like this…
Conversa>on Focused
…but a little cooperation goes a long way…
Working code and
Working Automated Acceptance Tests Exploratory tes>ng,
usability tes>ng...
Shared understanding
StoryExamplesAutomated acceptance criteria
Conversa>on Focused
We call this “The Three Amigos”
BA and/or product owner
Tester Developer Automatable Acceptance Criteria
Shared understanding
Conversa>on Focused
We call this “The Three Amigos”
Conversa>on Focused
Behaviour Driven Development is…
Example-‐based
Example-‐based
Behaviour Driven Development is…
Value-‐Driven
Behaviour Driven Development is…
Outside-‐in
OutsideIn
Behaviour Driven Development is…
Executable Specifica>ons
More value faster
Delivery Time
Trad
i>on
al
Using BDD
31% faster delivery
Behaviour Driven Development is…
Higher Quality
Defect Rate
Trad
i>on
al
Using BDD
4 >mes less defects
Behaviour Driven Development is…
Scenario
Step Defini>ons
Low level specifica>ons (aka “unit tests”)
Applica>on Code
BDD guides development
Oh, the things you can learn…
BDD guides development
What would we like the API to look like?
BDD guides development
Then write low-‐level specifica>ons for the code
BDD guides development
Then write low-‐level specifica>ons for the code
BDD guides development
“Every class is an API for someone”
BDD in Ac>on -‐ some real-‐world examples
Mission cri;cal legacy web applica;on
Case 1 -‐ an e-‐commerce web site
Frequent small changes
Business requires fast release cycle
Background
Case 1 -‐ an e-‐commerce web site
Approach
“BDD-‐style” regression tests
High communica;on value
Designed for ease of maintenance
Illustrate key business scenarios
Minimum ini;al impact on team
“BDD-‐style” regression tests
Case 1 -‐ an e-‐commerce web site
Approach
Case 1 -‐ an e-‐commerce web site
Outcomes
Living documenta;on
Case 1 -‐ an e-‐commerce web site
Outcomes
Living documenta;on
Case 1 -‐ an e-‐commerce web site
Outcomes
Living documenta;on
New large-‐scale project
Case 2 -‐ a large financial ins>tu>on
7 years, 2 Scrum teams
Conserva;ve organisa;on
Background
Regulatory and traceability
Approach
Full team-‐wide BDD adop;on
Test automa;on for (almost) all acceptance criteria
Tight integra;on with JIRA for traceability
“Three-‐amigos” sessions to refine acceptance criteria
High ini;al impact on team
Case 2 -‐ a large financial ins>tu>on
\Approach
Case 2 -‐ a large financial ins>tu>on
Stories
Features
Capabilities
Goals
Requirements organised by feature and capability
\Approach
Case 2 -‐ a large financial ins>tu>on
Stories
Features
Capabilities
Goals
Requirements managed in JIRA
\Approach
Case 2 -‐ a large financial ins>tu>on
StoryExamplesAutomated acceptance criteria
“Three amigos” sessions refine acceptance criteria
\Approach
Case 2 -‐ a large financial ins>tu>on
Acceptance Criteria map back to JIRA
\Approach
Case 2 -‐ a large financial ins>tu>on
Stories
Features
Capabilities
Goals
Manual test cases managed in Zephyr
\Approach
Case 2 -‐ a large financial ins>tu>on
Stories
Features
Capabilities
Goals
Automated and Manual Tests produce Living Documenta;on
Acceptance Criteria
\Approach
Case 2 -‐ a large financial ins>tu>on
Releases organised in JIRA
\Outcomes
Case 2 -‐ a large financial ins>tu>on
Code coverage when from 8% to 80+%
Very liZle rework to delivered features
Well documented APIs
Automated tests used to demonstrate features
Happy teams!
BDD involves a major culture change
BDD Adop>on -‐ Tips and Tricks
Don’t skimp on training!
Put care into your test automa;on
Need tester and BA buy-‐in
References
http://jbehave.orgBDD in Java
http://thucydides.infoLiving Documentation
Issue tracking and Agile project management
Manual test case management in JIRA