SlideShare a Scribd company logo
@sebrose h)p://cucumber.io
Seb Rose
Cucumber Limited
seb@cucumber.io
10 things you need to know about
Specflow
@sebrose h)p://cucumber.io
Seb Rose
Cucumber Limited
seb@cucumber.io
10 things you need to know about
BDD, Cucumber and Specflow
@sebrose h)p://cucumber.io
0. Know your BDD history
@sebrose h)p://cucumber.io
Last century?
h)p://www.serena.com/docs/agile/papers/Managing-The-Development-of-Large-SoEware-Systems.pdf
1970
@sebrose h)p://cucumber.io
2002
2006
1995
1997
1990s 1994
1980s
@sebrose h)p://cucumber.io
Agile manifesto signatories
2001
@sebrose h)p://cucumber.io
h)p://media.mediatemple.netdna-cdn.com/wp-content/uploads/2013/01/floops_loops.png
@sebrose h)p://cucumber.io
Chris Ma)s working with Rohit Darji
develop
“Pair Analysis”
2001
@sebrose h)p://cucumber.io
While using and teaching agile pracUces
like test-driven development (TDD) on
projects in different environments, I kept
coming across the same confusion and
misunderstandings.
Dan North
c. 2002
h)p://dannorth.net/introducing-bdd/
@sebrose h)p://cucumber.io
2002 (published 2005)
@sebrose h)p://cucumber.io
Chris Ma)s working with Sanela Hodzic
formalise
“Break the model”
2003
@sebrose h)p://cucumber.io
At the end of 2003, I decided it was Ume
to put my money – or at least my Ume –
where my mouth was. I started wriUng a
replacement for JUnit called JBehave,
which removed any reference to tesUng
and replaced it with a vocabulary built
around verifying behaviour.
Dan North
h)p://dannorth.net/introducing-bdd/
@sebrose h)p://cucumber.io
Chris Ma)s and Dan North discuss
the power of “should”
on a flight back from
Agile Development Conference 2004
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
Given/Then/When sees the light of day
Acceptance Criteria:
Prevent cash withdrawal when overdrawn
Given successfully login from user login

and the account is in overdrawn [balance = -50]

When the user requests cash [request 20]

Then refuse cash

and return card
abc.truemesh.com/archives/2004_11.html
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
Feature InjecUon & Real OpUons
2007 (published 2014)
@sebrose h)p://cucumber.io
2008 (published 2012)
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
2009
h)p://www.specflow.org/media/specflow_logo.png
@sebrose h)p://cucumber.io
2009 2011
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
BDD is a second-generaUon, outside-
in, pull-based, mulUple-stakeholder,
mulUple-scale, high-automaUon, agile
methodology.
It describes a cycle of interacUons with
well-defined outputs, resulUng in the
delivery of working, tested soEware
that ma)ers.
Dan North
h)p://skillsma)er.com/podcast/java-jee/how-to-sell-bdd-to-the-business
@sebrose h)p://cucumber.io
1. Different names, same idea
h)p://lizkeogh.com/2011/06/27/atdd-vs-bdd-and-a-po)ed-history-of-some-related-stuff/
What’s the
difference
between TDD,
ATDD, BDD
and SbE?
They’re
called
different
things
@sebrose h)p://cucumber.io
The best TDD
pracUUoners...
Work from the outside-in, i.e. test-first
Use examples to clarify their requirements
Develop and use a ubiquitous language
@sebrose h)p://cucumber.io
The best BDD
pracUUoners...
Focus on value
Discover examples collaboraAvely
Create living documentaAon
@sebrose h)p://cucumber.io
2. Tools are NOT essenAal
@sebrose h)p://cucumber.io
BDD is a second-generaUon, outside-
in, pull-based, mulUple-stakeholder,
mulUple-scale, high-automaUon, agile
methodology.
It describes a cycle of interacUons with
well-defined outputs, resulUng in the
delivery of working, tested soEware
that ma)ers.
Dan North
h)p://skillsma)er.com/podcast/java-jee/how-to-sell-bdd-to-the-business
@sebrose h)p://cucumber.io
having conversa*ons
is more important than
capturing conversa*ons
is more important than
automa3ng conversa*ons
Liz Keogh
h)p://lizkeogh.com/2014/01/22/using-bdd-with-legacy-systems/
@sebrose h)p://cucumber.io
h)p://lizkeogh.com/2011/03/04/step-away-from-the-tools/
Have enough conversaUons to know how to
get started. Find out where the riskiest bits
are, and where the system behaves
unusually. Chat. Discuss. Discover. Work out
how, and when, you’re going to get feedback
on the work you’re about to do.
Then, and only then, reach for the tools.
Liz Keogh
@sebrose h)p://cucumber.io
h)p://www.accepUc.com/blog/wp-content/uploads/2013/09/bdd.jpg
3. CollaboraAon IS essenAal
@sebrose h)p://cucumber.io
h)ps://cucumber.pro/blog/2014/03/03/the-worlds-most-misunderstood-collaboraUon-tool.html
When you do BDD/SpecificaUon by
Example and Outside-in, regression tests fall
out at the other end. They are a by-product
of those acUviUes. TesUng isn't the acUvity
itself.
Cucumber is first a foremost a collaboraUon
tool that aims to bring a common
understanding to soEware teams - across
roles.
Aslak Hellesøy
@sebrose h)p://cucumber.io
Ideas
User Stories
Examples
Automated Tests
Code
@sebrose h)p://cucumber.io
h)p://www.developersurvivalguide.com/tag/agile/
@sebrose h)p://cucumber.io
4. Specflow is simple
Core concepts
Features
-Scenarios
-Steps
-Gherkin
Glue code
-Step definiUons
-C# (& others)
ApplicaUon
@sebrose h)p://cucumber.io
Feature: Team Scoring
Teams start with zero score.
Correct answer gets points depending on
how difficult it is.
Scenario: Score starts at 0
Given I register a team
Then my score is 0
Scenario: Correct easy answer scores 10
Given I register a team
And I start playing a game
When I submit a correct easy answer
Then my score is 10
Given I register a team
Then my score is 0
Given I register a team
And I start playing a game
When I submit a correct easy answer
Then my score is 10
@sebrose h)p://cucumber.io
Given(/^I register a team$/) do
pending
end
Ruby
@sebrose h)p://cucumber.io
import cucumber.api.java.en.*;
public class HikerStepDef {
@Given("^I register a team$")
public void iRegisterATeam()
throws Throwable {
throw new PendingException();
}
}
Java
@sebrose h)p://cucumber.io
using TechTalk.SpecFlow;
[Binding]
public class GameSteps
{
[Given(@"I register a team")]
public void GivenIRegisterATeam()
{
ScenarioContext.Current.Pending();
}
}
C#
@sebrose h)p://cucumber.io
[Then(@"my score is (.*)")]
public void ThenMyScoreIs(int p0)
{
ScenarioContext.Current.Pending();
}
@sebrose h)p://cucumber.io
[Then(@"my score is (.*)")]
public void ThenMyScoreIs(int score)
{
ScenarioContext.Current.Pending();
}
@sebrose h)p://cucumber.io
[Then(@"my score is (d*)")]
public void ThenMyScoreIs(int score)
{
ScenarioContext.Current.Pending();
}
@sebrose h)p://cucumber.io
[Then(@"my score is (d*)")]
public void ThenMyScoreIs(int score)
{
Assert.AreEqual(score, game.Score);
}
@sebrose h)p://cucumber.io
5. Cucumber and Specflow aren’t
exactly the same
@sebrose h)p://cucumber.io
Given/When/Then namespaces
Global namespace
- Given/When/Then interchangeable
Separate namespaces
- Given/When/Then disUnct
- And/But bind to preceding namespace
- [StepDefiniUon] for compaUbility
@sebrose h)p://cucumber.io
Binding & test frameworks
Behind the scenes
- may need to specify paths
- select required plugin(s)
Some magic code generaUon
- NUnit by default
- configuraUon changes for others
- several output opUons
@sebrose h)p://cucumber.io
Sharing data between steps
Varies by implementaUon
- Ruby: World object
- Java: Dependency InjecUon
Context object(s)
- Injected
- Scenario
- Feature
@sebrose h)p://cucumber.io
Hooks
Before & AEer
Ruby: Around, AEerStep
Before & AEer
BeforeStep & AEerStep
BeforeFeature & AEerFeature
BeforeTestRun & AEerTestRun
BeforeScenarioBlock &
AEerScenarioBlock
@sebrose h)p://cucumber.io
DocumentaUon
Poor online documentaUon
Books for Ruby & Java
Extensive online documentaUon
Book in the pipeline
@sebrose h)p://cucumber.io
h)ps://cemarking.net/wp-content/uploads/2014/01/User-Manual_featured.jpg
6. Prefer living documentaAon
Acceptance
criteria
User Story
Examples
Feature: Team Scoring
Teams start with zero score.
Correct answer gets points depending on 

how difficult it is.
Scenario: Score starts at 0
Given I register a team
Then my score is 0
Scenario: Correct easy answer scores 10
Given I register a team
When I submit a correct easy answer
Then my score is 10
Scenario: Correct hard answer scores 50
Given I register a team
When I submit a correct hard answer
Then my score is 50
Other forms of documentaAon are
also necessary!
@sebrose h)p://cucumber.io
7. Don’t forget the testers
@sebrose claysnow.co.uk
h)p://claysnow.co.uk/architectural-alignment-and-test-induced-design-damage-fallacy/
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
@sebrose h)p://cucumber.io
http://1.bp.blogspot.com/_YzKCMr-tcMM/TFLIGeqTJfI/AAAAAAAAARQ/AhNW62KX5EA/s1600/cartoon6.jpg
8. BDD is not just for testers
Support code
Features
-Scenarios
-Steps
-Gherkin
Glue code
-Step definiUons
-Java / C#
ApplicaUon
Support
Code
Ubiquitous
Language
@sebrose h)p://cucumber.io
9. The right amount of detail
@sebrose h)p://cucumber.io
“I get paid for code that works, not for tests, so
my philosophy is to test as li8le as possible to
reach a given level of confidence ...
“I suspect this level of confidence is high
compared to industry standards”
h)p://stackoverflow.com/quesUons/153234/how-deep-are-your-unit-tests/153565#153565
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
@sebrose h)p://cucumber.io
ImperaUve DeclaraUve
Keep it Focussed:
Avoid incidental
details
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: Sign up
Scenario: Create a new user account
Given I am not logged in
And I visit the homepage
And I follow "Sign up"
And I fill in "Username" with "Seb"
And I fill in "Password" with "password"
And I fill in "Confirm password" with "password"
When I press "Sign up"
Then a new account should be created for me
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: Sign up
Scenario: Create a new user account
Given I am not logged in
And I decide to sign up for an account
And I provide an acceptable username
And I provide an acceptable password
And I confirm my password choice
When I submit these details
Then a new account should be created for me
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: Sign up
Scenario: New user redirected to their own page
Given I am not logged in
And I decide to sign up for an account
And I provide an acceptable username
And I provide an acceptable password
And I confirm my password choice
When I submit these details
Then I should be on my feeds page
And I should see "Hello, Seb"
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: Sign up
Scenario: New user redirected to their own page
Given I am not logged in
And I decide to sign up for an account
And I provide an acceptable username
And I provide an acceptable password
And I confirm my password choice
When I submit these details
Then I should be on my feeds page
And I should see a greeting message
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: Sign up
Scenario: New user redirected to their own page
When I sign up for a new account
Then I should be taken to my feeds page
And I should see a greeting message
@sebrose h)p://cucumber.io
Imperative vs
Declarative Style
Feature: The entire system
This feature illustrates what can happen when you
take the declarative style too far.
Scenario: It works
When I use the system
Then it should work perfectly
@sebrose h)p://cucumber.io
(A great blog post on this subject by Dan North)
h)p://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
Whose domain is it
anyway?
@sebrose h)p://cucumber.io
10. Deliberate pracAce
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
@sebrose h)p://cucumber.io
01 BDD demands collaboraUon


10 Examples facilitate feedback
102 things you should know
@sebrose h)p://cucumber.io
Seb Rose


Twi6er: @sebrose
Blog: cucumber.io/blog
E-mail: seb@cucumber.io

More Related Content

PDF
#NoEstimates does not mean "No estimates!" - Agile Cambridge 2015
PDF
Real world continuous delivery
PDF
Introduction to BDD with Cucumber for Java
PDF
Planning poker in a nutshell
PDF
Test automation is dead CoDe Copenhagen 2016
PDF
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
PPTX
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
PDF
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
#NoEstimates does not mean "No estimates!" - Agile Cambridge 2015
Real world continuous delivery
Introduction to BDD with Cucumber for Java
Planning poker in a nutshell
Test automation is dead CoDe Copenhagen 2016
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study

Viewers also liked (19)

KEY
BDD for Rails Legacy Code
PPT
Introducing bdd elements to unit testing.pptx
PDF
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
PPTX
DOES14 - Jonny Wooldridge - The Cambridge Satchel Company - 10 Enterprise Tip...
PDF
Jvm-bdd-quality-driven
PPTX
Agile Tour Pune 2015:Test automation using BDD - Anita Pol and Sachin Salvekar
PDF
Bdd for legacy system
PDF
ATAAS 2016 - Amol pradhan - Bridging the gap between business and technology ...
PDF
Impact Map Your Project
PDF
Object-Oriented BDD w/ Cucumber by Matt van Horn
PPTX
DSL, Page Object and Selenium – a way to reliable functional tests
PDF
BDD com Cucumber
PDF
BDD and Test Automation in Evalutionary Product Suite
ODP
Mock Aren't Stub 讀後心得
PDF
Impact Maps/Story Maps - liefern was wirklich zählt
PDF
Upcoming events 2017
PDF
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (BDD Lond...
PDF
Moving away from legacy code (AgileCymru)
PDF
Help! My Legacy Application is Unmaintainable!
BDD for Rails Legacy Code
Introducing bdd elements to unit testing.pptx
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
DOES14 - Jonny Wooldridge - The Cambridge Satchel Company - 10 Enterprise Tip...
Jvm-bdd-quality-driven
Agile Tour Pune 2015:Test automation using BDD - Anita Pol and Sachin Salvekar
Bdd for legacy system
ATAAS 2016 - Amol pradhan - Bridging the gap between business and technology ...
Impact Map Your Project
Object-Oriented BDD w/ Cucumber by Matt van Horn
DSL, Page Object and Selenium – a way to reliable functional tests
BDD com Cucumber
BDD and Test Automation in Evalutionary Product Suite
Mock Aren't Stub 讀後心得
Impact Maps/Story Maps - liefern was wirklich zählt
Upcoming events 2017
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (BDD Lond...
Moving away from legacy code (AgileCymru)
Help! My Legacy Application is Unmaintainable!
Ad

Similar to 10 things about BDD, Cucumber and SpecFlow - Long Version 2016 (20)

PPTX
BDD Selenium for Agile Teams - User Stories
PPTX
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
PPTX
Behavior Driven Development
PDF
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
PPTX
BDD from QA side
PPTX
Bdd with Cucumber and Mocha
PPT
Behavior Driven Development by Example
PDF
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
ODP
Test Automation Framework using Cucumber BDD overview (part 1)
PPTX
Behaviour drivendevelopment
PPTX
Behaviour driven development
PPTX
Behaviour driven development
PPTX
Behaviour driven development
PPTX
Behaviour drivendevelopment
PPTX
Behaviour driven development
PPTX
Behaviour drivendevelopment
PPTX
Topic tdd-and-bdd b4usolution
PPTX
Introduction to Bdd and cucumber
PPTX
Design your tests to behave - An introduction To BDD!
PDF
cucumber harpal.pdf
BDD Selenium for Agile Teams - User Stories
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Behavior Driven Development
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
BDD from QA side
Bdd with Cucumber and Mocha
Behavior Driven Development by Example
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Test Automation Framework using Cucumber BDD overview (part 1)
Behaviour drivendevelopment
Behaviour driven development
Behaviour driven development
Behaviour driven development
Behaviour drivendevelopment
Behaviour driven development
Behaviour drivendevelopment
Topic tdd-and-bdd b4usolution
Introduction to Bdd and cucumber
Design your tests to behave - An introduction To BDD!
cucumber harpal.pdf
Ad

More from Seb Rose (20)

PDF
AI and developer obsolescence - BCS 2025.pdf
PDF
Software contracts - Global Enterprise Agile 2023.pdf
PDF
Micro-service delivery - without the pitfalls
PDF
DevSecOps - Agile Get-Together 2022.pdf
PDF
Contract testing - Sealights 2022.pdf
PDF
Example mapping - slice any story into testable examples - SoCraTes 2022.pdf
PDF
Software testing - learning to walk again (expoQA22)
PDF
DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021
PDF
A brief history of requirements - Unicom 2022
PDF
Example mapping (with builds) - ProductWorld 2022
PDF
Example mapping - ProductWorld 2022
PDF
No code, low code, machine code QA ATL 2021
PDF
No code, low code, machine code QA ATL 2021
PDF
No code, low code, machine code - Unicom 2021
PDF
BDD: from soup to nuts - The Future of Work Scotland 2021
PDF
Contrasting test automation and BDD - 2020
PDF
Are BDD and test automation the same thing? Automation Guild 2021
PDF
"Our BDDs are broken!" Lean Agile Exchange 2020
PDF
User stories: from good intentions to bad advice - Agile Scotland 2019
PDF
User stories: from good intentions to bad advice - Lean Agile Scotland 2019
AI and developer obsolescence - BCS 2025.pdf
Software contracts - Global Enterprise Agile 2023.pdf
Micro-service delivery - without the pitfalls
DevSecOps - Agile Get-Together 2022.pdf
Contract testing - Sealights 2022.pdf
Example mapping - slice any story into testable examples - SoCraTes 2022.pdf
Software testing - learning to walk again (expoQA22)
DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021
A brief history of requirements - Unicom 2022
Example mapping (with builds) - ProductWorld 2022
Example mapping - ProductWorld 2022
No code, low code, machine code QA ATL 2021
No code, low code, machine code QA ATL 2021
No code, low code, machine code - Unicom 2021
BDD: from soup to nuts - The Future of Work Scotland 2021
Contrasting test automation and BDD - 2020
Are BDD and test automation the same thing? Automation Guild 2021
"Our BDDs are broken!" Lean Agile Exchange 2020
User stories: from good intentions to bad advice - Agile Scotland 2019
User stories: from good intentions to bad advice - Lean Agile Scotland 2019

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Getting Started with Data Integration: FME Form 101
PPTX
A Presentation on Touch Screen Technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Approach and Philosophy of On baking technology
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
Tartificialntelligence_presentation.pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Getting Started with Data Integration: FME Form 101
A Presentation on Touch Screen Technology
Assigned Numbers - 2025 - Bluetooth® Document
Unlocking AI with Model Context Protocol (MCP)
cloud_computing_Infrastucture_as_cloud_p
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Encapsulation theory and applications.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Univ-Connecticut-ChatGPT-Presentaion.pdf
TLE Review Electricity (Electricity).pptx
Heart disease approach using modified random forest and particle swarm optimi...
Approach and Philosophy of On baking technology
SOPHOS-XG Firewall Administrator PPT.pptx
A Presentation on Artificial Intelligence
Tartificialntelligence_presentation.pptx
DP Operators-handbook-extract for the Mautical Institute
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

10 things about BDD, Cucumber and SpecFlow - Long Version 2016