SlideShare a Scribd company logo
1 of 20
BDD with SpecFlow
Pascal Laurin
February 2015
@plaurin78
pascal.laurin@outlook.com
www.pascallaurin.com
Microsoft C# MVP
MSDEVMTL user group organizer
Developer & Architect at GSoft
TDD with B instead of a T!
Somewhat inspired by TDD but using behaviours instead
of tests
What level of behaviours?
Systems level
Applications level
Components level
Classes level
| 2
What is BDD?
Unit Tests
Focus on classes
Validate the implementation
Integrated Tests / Functional Tests / Acceptance Tests
Focus on components
Validate behaviours
Systems Tests
Focus on the complete system
Validate the whole system environment including external
dependencies
| 3
Differences between types of
automated tests
By changing the level of abstraction and the way we
communicate
Using the language of the business domain
Using sentences to express the expected behaviours
By focusing on what the system under test should do
Requirements, use cases, specifications and behaviours are all
useful for BDD
| 4
How to validate behaviours instead
of tests?
Not just for developers
Analysts, QA, business people must also included in this process
Specifications as tests, documentation and collaboration
tool
By automating the specifications like unit tests
By processing specifications as the documentation of the system
By working together on the specifications before writing code
What would a process like that looks like?
| 5
Going further
| 6
[1] Specification by Example
1. Deriving scope from goals
2. Specifying collaboratively
3. Illustrating using examples
4. Refining the specification
5. Automating validation without changing specifications
6. Validating frequently
7. Evolving a documentation system
| 7
Specification by Example
An example of a good business goal
Increase repeat sales to existing customers by 50% over the next
12 months.
| 8
Business goals
User stories for a basic loyalty system
In order to be able to do direct marketing of products to existing
customers, as a marketing manager I want customers to register
personal details by joining a VIP program.
In order to entice existing customers to register for the VIP
program, as a marketing manager I want the system to offer
free delivery on certain items to VIP customers.
In order to save money, as an existing customer I want to receive
information on available special offers.
| 9
Scope
Free delivery
VIP customer with five books in the cart gets free delivery.
VIP customer with four books in the cart doesn’t get free delivery.
Regular customer with five books in the cart doesn’t get free
delivery.
VIP customer with five washing machines in the cart doesn’t get
free delivery.
VIP customer with five books and a washing machine in the cart
doesn’t get free delivery.
| 10
Key examples
Free delivery
Free delivery is offered to VIP customers once they purchase a
certain number of books. Free delivery is not offered to regular
customers or VIP customers buying anything other than books.
Given that the minimum number of books to get free delivery is
five, then we expect the following:
| 11
Specification with examples
Customer type Cart contents Delivery
VIP 5 books Free
VIP 4 books Standard
Regular 10 books Standard
VIP 5 washing machines Standard
VIP 5 books, 1 washing machine Standard
| 12
Specification with examples
1. Deriving scope from goals
2. Specifying collaboratively
3. Illustrating using examples
4. Refining the specification
5. Automating validation without changing
specifications
6. Validating frequently
7. Evolving a documentation system
| 13
Specification by Example
14
SpecFlow
Visual Studio extension, runs like unit tests using any test runner
Write specifications in English with syntax coloring and auto-
completion using the Gherkin[1] language
[1] https://github.com/cucumber/cucumber/wiki/Gherkin
15
SpecFlow
Integrated debugging support
Matching specification lines with step definitions using a RegEx
syntax
Use ScenarioContext.Current and generic Get/Set methods to
store and retrieve test related data between step definitions
16
SpecFlow
Provides code snippet to implement missing step definitions either by
pressing F12 on an unmatched line or by runner the tests
1. Deriving scope from goals
2. Specifying collaboratively
3. Illustrating using examples
4. Refining the specification
5. Automating validation without changing specifications
6. Validating frequently
7. Evolving a documentation system
| 17
Specification by Example
| 18
Specification by Example book
BDD and TDD
Unit tests, integrated tests and manual tests are all important!
Improving communication
Use business domain language, higher level of abstraction,
avoiding technical vocabulary and implementation details
Requires investment
Good software design practices will help
You won’t necessarily hit the same challenges than with TDD
The real value is in collaboration and automation!
| 19
Conclusion
References
[1] Specification by Example
• http://specificationbyexample.com/
SpecFlow
• http://specflow.org/home.aspx
SlideShare of the presentation
• http://www.slideshare.net/PascalLaurin
BitBucket for the code
• https://bitbucket.org/pascallaurin/bdd-talk
@plaurin78
pascal.laurin@outlook.com
www.pascallaurin.com
| 20
Questions?

More Related Content

What's hot

Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
Stephen Tucker
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
toteb5
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
Jeremy Kendall
 

What's hot (20)

Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
 
ATDD in Practice
ATDD in PracticeATDD in Practice
ATDD in Practice
 
ATDD in practice
ATDD in practiceATDD in practice
ATDD in practice
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
TDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & WhereTDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & Where
 
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestable
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Win at life with unit testing
Win at life with unit testingWin at life with unit testing
Win at life with unit testing
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 

Viewers also liked

Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
extentconf Tsoy
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
John Ferguson Smart Limited
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
Brandon Keepers
 

Viewers also liked (20)

C# 6
C# 6C# 6
C# 6
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
7 astuces pour améliorer vos tests unitaires
7 astuces pour améliorer vos tests unitaires7 astuces pour améliorer vos tests unitaires
7 astuces pour améliorer vos tests unitaires
 
L'amélioration des tests unitaires par le refactoring
L'amélioration des tests unitaires par le refactoringL'amélioration des tests unitaires par le refactoring
L'amélioration des tests unitaires par le refactoring
 
Cloud design patterns
Cloud design patternsCloud design patterns
Cloud design patterns
 
Tests automatisés java script
Tests automatisés java scriptTests automatisés java script
Tests automatisés java script
 
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
 
Scrum + Behavior Driven Development (BDD) - Colombo
Scrum + Behavior Driven Development (BDD) - ColomboScrum + Behavior Driven Development (BDD) - Colombo
Scrum + Behavior Driven Development (BDD) - Colombo
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
 
Introduction to TDD and BDD
Introduction to TDD and BDDIntroduction to TDD and BDD
Introduction to TDD and BDD
 
Behavior driven development for Mobile apps
Behavior driven development for Mobile appsBehavior driven development for Mobile apps
Behavior driven development for Mobile apps
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Quality Jam: BDD, TDD and ATDD for the Enterprise
Quality Jam: BDD, TDD and ATDD for the EnterpriseQuality Jam: BDD, TDD and ATDD for the Enterprise
Quality Jam: BDD, TDD and ATDD for the Enterprise
 
The WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecThe WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpec
 
Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)Outside In - Behaviour Driven Development (BDD)
Outside In - Behaviour Driven Development (BDD)
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 

Similar to Behaviour Driven Development with SpecFlow

Best practices for implementing and maintaining successful standards
Best practices for implementing and maintaining successful standardsBest practices for implementing and maintaining successful standards
Best practices for implementing and maintaining successful standards
Veeva Systems
 
Best practices to include in your OpenERP implementation contracts. Sandro Bo...
Best practices to include in your OpenERP implementation contracts. Sandro Bo...Best practices to include in your OpenERP implementation contracts. Sandro Bo...
Best practices to include in your OpenERP implementation contracts. Sandro Bo...
Odoo
 
FlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at HumanaFlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at Humana
Databricks
 
Reduced specification by_example2
Reduced specification by_example2Reduced specification by_example2
Reduced specification by_example2
afreidah
 

Similar to Behaviour Driven Development with SpecFlow (20)

01- Lecture -Introduction to IT Agile Development.
01- Lecture -Introduction to IT Agile Development.01- Lecture -Introduction to IT Agile Development.
01- Lecture -Introduction to IT Agile Development.
 
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh EastmanBehavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
 
Best practices for implementing and maintaining successful standards
Best practices for implementing and maintaining successful standardsBest practices for implementing and maintaining successful standards
Best practices for implementing and maintaining successful standards
 
Puppet + Diaxon: Getting to the next stage of DevOps evolution
Puppet + Diaxon: Getting to the next stage of DevOps evolutionPuppet + Diaxon: Getting to the next stage of DevOps evolution
Puppet + Diaxon: Getting to the next stage of DevOps evolution
 
Benchmarking
BenchmarkingBenchmarking
Benchmarking
 
Agile testing
Agile testingAgile testing
Agile testing
 
Best practices to include in your OpenERP implementation contracts. Sandro Bo...
Best practices to include in your OpenERP implementation contracts. Sandro Bo...Best practices to include in your OpenERP implementation contracts. Sandro Bo...
Best practices to include in your OpenERP implementation contracts. Sandro Bo...
 
Unifying feature management with experiments - Server Side Webinar (1).pdf
Unifying feature management with experiments - Server Side Webinar (1).pdfUnifying feature management with experiments - Server Side Webinar (1).pdf
Unifying feature management with experiments - Server Side Webinar (1).pdf
 
Training program BaffleSol academy of learning
Training program BaffleSol academy of learningTraining program BaffleSol academy of learning
Training program BaffleSol academy of learning
 
A Step-by-Step Guide.pptx
A Step-by-Step Guide.pptxA Step-by-Step Guide.pptx
A Step-by-Step Guide.pptx
 
Software testing methodologies to watch out in 2020
Software testing methodologies to watch out in 2020Software testing methodologies to watch out in 2020
Software testing methodologies to watch out in 2020
 
Test Automation using UiPath Test Suite - Developer Circle Part-1.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-1.pdfTest Automation using UiPath Test Suite - Developer Circle Part-1.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-1.pdf
 
FlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at HumanaFlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at Humana
 
Agile Release Management Best Practices
Agile Release Management Best PracticesAgile Release Management Best Practices
Agile Release Management Best Practices
 
Independent verification & validation presented by Maneat v02
Independent verification & validation presented by Maneat v02Independent verification & validation presented by Maneat v02
Independent verification & validation presented by Maneat v02
 
The DevOps Playbook: How to Start, Scale, and Succeed
The DevOps Playbook: How to Start, Scale, and SucceedThe DevOps Playbook: How to Start, Scale, and Succeed
The DevOps Playbook: How to Start, Scale, and Succeed
 
DevTestOps
DevTestOpsDevTestOps
DevTestOps
 
General technical interview questions
General technical interview questionsGeneral technical interview questions
General technical interview questions
 
Test Policy and Practices
Test Policy and PracticesTest Policy and Practices
Test Policy and Practices
 
Reduced specification by_example2
Reduced specification by_example2Reduced specification by_example2
Reduced specification by_example2
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Behaviour Driven Development with SpecFlow

  • 1. BDD with SpecFlow Pascal Laurin February 2015 @plaurin78 pascal.laurin@outlook.com www.pascallaurin.com Microsoft C# MVP MSDEVMTL user group organizer Developer & Architect at GSoft
  • 2. TDD with B instead of a T! Somewhat inspired by TDD but using behaviours instead of tests What level of behaviours? Systems level Applications level Components level Classes level | 2 What is BDD?
  • 3. Unit Tests Focus on classes Validate the implementation Integrated Tests / Functional Tests / Acceptance Tests Focus on components Validate behaviours Systems Tests Focus on the complete system Validate the whole system environment including external dependencies | 3 Differences between types of automated tests
  • 4. By changing the level of abstraction and the way we communicate Using the language of the business domain Using sentences to express the expected behaviours By focusing on what the system under test should do Requirements, use cases, specifications and behaviours are all useful for BDD | 4 How to validate behaviours instead of tests?
  • 5. Not just for developers Analysts, QA, business people must also included in this process Specifications as tests, documentation and collaboration tool By automating the specifications like unit tests By processing specifications as the documentation of the system By working together on the specifications before writing code What would a process like that looks like? | 5 Going further
  • 7. 1. Deriving scope from goals 2. Specifying collaboratively 3. Illustrating using examples 4. Refining the specification 5. Automating validation without changing specifications 6. Validating frequently 7. Evolving a documentation system | 7 Specification by Example
  • 8. An example of a good business goal Increase repeat sales to existing customers by 50% over the next 12 months. | 8 Business goals
  • 9. User stories for a basic loyalty system In order to be able to do direct marketing of products to existing customers, as a marketing manager I want customers to register personal details by joining a VIP program. In order to entice existing customers to register for the VIP program, as a marketing manager I want the system to offer free delivery on certain items to VIP customers. In order to save money, as an existing customer I want to receive information on available special offers. | 9 Scope
  • 10. Free delivery VIP customer with five books in the cart gets free delivery. VIP customer with four books in the cart doesn’t get free delivery. Regular customer with five books in the cart doesn’t get free delivery. VIP customer with five washing machines in the cart doesn’t get free delivery. VIP customer with five books and a washing machine in the cart doesn’t get free delivery. | 10 Key examples
  • 11. Free delivery Free delivery is offered to VIP customers once they purchase a certain number of books. Free delivery is not offered to regular customers or VIP customers buying anything other than books. Given that the minimum number of books to get free delivery is five, then we expect the following: | 11 Specification with examples
  • 12. Customer type Cart contents Delivery VIP 5 books Free VIP 4 books Standard Regular 10 books Standard VIP 5 washing machines Standard VIP 5 books, 1 washing machine Standard | 12 Specification with examples
  • 13. 1. Deriving scope from goals 2. Specifying collaboratively 3. Illustrating using examples 4. Refining the specification 5. Automating validation without changing specifications 6. Validating frequently 7. Evolving a documentation system | 13 Specification by Example
  • 14. 14 SpecFlow Visual Studio extension, runs like unit tests using any test runner Write specifications in English with syntax coloring and auto- completion using the Gherkin[1] language [1] https://github.com/cucumber/cucumber/wiki/Gherkin
  • 15. 15 SpecFlow Integrated debugging support Matching specification lines with step definitions using a RegEx syntax Use ScenarioContext.Current and generic Get/Set methods to store and retrieve test related data between step definitions
  • 16. 16 SpecFlow Provides code snippet to implement missing step definitions either by pressing F12 on an unmatched line or by runner the tests
  • 17. 1. Deriving scope from goals 2. Specifying collaboratively 3. Illustrating using examples 4. Refining the specification 5. Automating validation without changing specifications 6. Validating frequently 7. Evolving a documentation system | 17 Specification by Example
  • 18. | 18 Specification by Example book
  • 19. BDD and TDD Unit tests, integrated tests and manual tests are all important! Improving communication Use business domain language, higher level of abstraction, avoiding technical vocabulary and implementation details Requires investment Good software design practices will help You won’t necessarily hit the same challenges than with TDD The real value is in collaboration and automation! | 19 Conclusion
  • 20. References [1] Specification by Example • http://specificationbyexample.com/ SpecFlow • http://specflow.org/home.aspx SlideShare of the presentation • http://www.slideshare.net/PascalLaurin BitBucket for the code • https://bitbucket.org/pascallaurin/bdd-talk @plaurin78 pascal.laurin@outlook.com www.pascallaurin.com | 20 Questions?