SlideShare a Scribd company logo
behavior driven
development in
.NET
MICHAEL MCGUIRE
@MONOCULARVISION
so what’s the
problem?
Behavior Driven Development
behavior driven development
“BDD is a second-generation, outside–in,
pull-based, multiple-stakeholder, multiple-
scale, high-automation, agile methodology.
It describes a cycle of interactions with well-
defined outputs, resulting in the delivery of
working, tested software that matters.”
- Dan North
BDD History
 Stemmed from confusion over TDD
 Where to start?
 What should I test?
 What should I not test?
 How big should a single test be?
 What should I name my tests?
 Grown to include agile analysis and automated testing
emphasize behavior over testing
 Test method names are sentences
 Keeps test methods focused
 Expressive test name is helpful when a test fails
 Test methods begin with “should”
 Keeps classes focused on doing one thing (Single
Responsibility Principle)
 Acceptance criteria should be executable
 Requirements are behavior too!
TDD
Make It
Pass
Refactor
Write
Failing
Unit Test
BDD is TDD
Make It
Pass
Refactor
Write
Failing
Unit Test
Write Failing
Acceptance
Test
Make It Pass
Automated Acceptance Criteria
 Structured user story format
 In order to <need>
 As a <role>
 I want to <feature>
 Focus put on the business need and benefit
 Scenarios give additional details about feature
 Given-When-Then
 http://www.specflow.org/
 Open source framework for the creation and execution of
automated acceptance tests in .NET
 Uses the Gherkin syntax for defining features and scenarios
 Generates NUnit or MSTest unit tests from feature file
SpecFlow Demo
driving your application
Selenium
 http://seleniumhq.org
 Pros
 Most major browsers supported -
PhantomJS, Chrome, IE, Firefox
and others
 Large community, many language
bindings
 Cons
 Simplistic API
WatiN
 http://watin.org/
 Pros
 Fairly easy to use
 Rich API (specific element types)
 Cons
 Supports only Internet Explorer and
Firefox
 Not a big community (.NET
specific)
Selenium + SpecFlow Demo
additional SpecFlow features
 Hooks
 [Before/After]TestRun
 [Before/After]Feature
 [Before/After]Scenario
 [Before/After]ScenarioBlock
 [Before/After]Step
 Tags/Tag Filtering on Hooks
 Step Argument Conversion
 [Scenario/Feature]Context
 Data Tables
additional considerations
 Setting up your application database for tests
 Attach/Detach database
 Clear/Load database tables
 Database transactions
 Faking/Mocking Database
 Imperative vs. Declarative tests
 http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-
in-user-stories.html
Links
 Behavior-Driven Development with SpecFlow and WatiN:
http://msdn.microsoft.com/en-us/magazine/gg490346.aspx
 Behavior Driven Development (BDD) with SpecFlow and ASP.NET
MVC: http://blog.stevensanderson.com/2010/03/03/behavior-
driven-development-bdd-with-specflow-and-aspnet-mvc/

More Related Content

PPTX
BDD with SpecFlow and Selenium
PPT
Test Automation Framework Development Introduction
PPTX
Automate your functional testing
PPT
Hybrid Automation Framework Development introduction
PDF
Laws of test automation framework
PPTX
JavaScript Unit Testing
PPTX
Grading the Quality of Selenium Tests
PPTX
Testing JavaScript Applications
BDD with SpecFlow and Selenium
Test Automation Framework Development Introduction
Automate your functional testing
Hybrid Automation Framework Development introduction
Laws of test automation framework
JavaScript Unit Testing
Grading the Quality of Selenium Tests
Testing JavaScript Applications

What's hot (20)

PPT
Stepin evening presented
PPTX
HDC 2010 - Creating Quality Software: A Look at Visual Studio 2010 Testing Tools
PDF
Ivan Pashko - Simplifying test automation with design patterns
PPTX
Bdd and spec flow
PPTX
Using Specflow for BDD
PPTX
j meter
PPTX
Test Automation Architecture That Works by Bhupesh Dahal
PDF
Automated Testing
PPTX
BDD for APIs
PPTX
Mobile Test Automation Framework : Presented By Shankar Garg
PPT
Centralized test automation framework implementation
PDF
Keyword Driven Testing
PPT
Hybrid Automation Framework Developement
PDF
Unit testing (workshop)
PPTX
Writing better tests for your java script app
PPTX
5 Considerations When Adopting Automated Testing
PPTX
Automation test framework with cucumber – BDD
PPTX
Qa process
PPTX
Type mock isolator
PDF
automation framework
Stepin evening presented
HDC 2010 - Creating Quality Software: A Look at Visual Studio 2010 Testing Tools
Ivan Pashko - Simplifying test automation with design patterns
Bdd and spec flow
Using Specflow for BDD
j meter
Test Automation Architecture That Works by Bhupesh Dahal
Automated Testing
BDD for APIs
Mobile Test Automation Framework : Presented By Shankar Garg
Centralized test automation framework implementation
Keyword Driven Testing
Hybrid Automation Framework Developement
Unit testing (workshop)
Writing better tests for your java script app
5 Considerations When Adopting Automated Testing
Automation test framework with cucumber – BDD
Qa process
Type mock isolator
automation framework
Ad

Viewers also liked (11)

PPTX
Automated Acceptance Test Practices and Pitfalls
PDF
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
PPTX
SpecFlow for Agile Teams
PPTX
Specflow
PDF
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
PDF
Test and Behaviour Driven Development (TDD/BDD)
PPT
Behavior Driven Development (BDD) and Agile Testing
KEY
Getting Comfortable with BDD
PDF
BDD in Action – principles, practices and real-world application
PPTX
Behavior Driven Development
PDF
BDD - Writing better scenario
Automated Acceptance Test Practices and Pitfalls
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
SpecFlow for Agile Teams
Specflow
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
Test and Behaviour Driven Development (TDD/BDD)
Behavior Driven Development (BDD) and Agile Testing
Getting Comfortable with BDD
BDD in Action – principles, practices and real-world application
Behavior Driven Development
BDD - Writing better scenario
Ad

Similar to Behavior Driven Development (20)

PPTX
DSL, Page Object and Selenium – a way to reliable functional tests
PPTX
Automated Acceptance Tests & Tool choice
PDF
Agile testing
ODP
Testing In Java4278
ODP
Testing In Java
PPS
Data driven automation-with_wati_n
PPTX
Mastering Test Automation: How To Use Selenium Successfully
PDF
Testing - How Vital and How Easy to use
PPTX
PHPConf.asia 2016 - BDD with Behat for Beginners
PPTX
Test team dynamics, Антон Мужайло
DOC
Khushboo_Resume
PPT
Best Practices In Load And Stress Testing Cmg Seminar[1]
PPTX
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
PPTX
DSL, Page Object и WebDriver – путь к надежным функциональным тестам
DOCX
Resume 2 year
DOC
Selva_Selenium
DOCX
MD Tareque Automation
PPT
Behavior Driven Development by Example
PDF
Software Quality and Test Strategies for Ruby and Rails Applications
PPTX
Whats New In 2010 (Msdn & Visual Studio)
DSL, Page Object and Selenium – a way to reliable functional tests
Automated Acceptance Tests & Tool choice
Agile testing
Testing In Java4278
Testing In Java
Data driven automation-with_wati_n
Mastering Test Automation: How To Use Selenium Successfully
Testing - How Vital and How Easy to use
PHPConf.asia 2016 - BDD with Behat for Beginners
Test team dynamics, Антон Мужайло
Khushboo_Resume
Best Practices In Load And Stress Testing Cmg Seminar[1]
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object и WebDriver – путь к надежным функциональным тестам
Resume 2 year
Selva_Selenium
MD Tareque Automation
Behavior Driven Development by Example
Software Quality and Test Strategies for Ruby and Rails Applications
Whats New In 2010 (Msdn & Visual Studio)

Recently uploaded (20)

PDF
Modernizing your data center with Dell and AMD
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PDF
KodekX | Application Modernization Development
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
A Presentation on Artificial Intelligence
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Modernizing your data center with Dell and AMD
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
KodekX | Application Modernization Development
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
A Presentation on Artificial Intelligence
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
NewMind AI Weekly Chronicles - August'25 Week I

Behavior Driven Development

  • 4. behavior driven development “BDD is a second-generation, outside–in, pull-based, multiple-stakeholder, multiple- scale, high-automation, agile methodology. It describes a cycle of interactions with well- defined outputs, resulting in the delivery of working, tested software that matters.” - Dan North
  • 5. BDD History  Stemmed from confusion over TDD  Where to start?  What should I test?  What should I not test?  How big should a single test be?  What should I name my tests?  Grown to include agile analysis and automated testing
  • 6. emphasize behavior over testing  Test method names are sentences  Keeps test methods focused  Expressive test name is helpful when a test fails  Test methods begin with “should”  Keeps classes focused on doing one thing (Single Responsibility Principle)  Acceptance criteria should be executable  Requirements are behavior too!
  • 8. BDD is TDD Make It Pass Refactor Write Failing Unit Test Write Failing Acceptance Test Make It Pass
  • 9. Automated Acceptance Criteria  Structured user story format  In order to <need>  As a <role>  I want to <feature>  Focus put on the business need and benefit  Scenarios give additional details about feature  Given-When-Then
  • 10.  http://www.specflow.org/  Open source framework for the creation and execution of automated acceptance tests in .NET  Uses the Gherkin syntax for defining features and scenarios  Generates NUnit or MSTest unit tests from feature file
  • 12. driving your application Selenium  http://seleniumhq.org  Pros  Most major browsers supported - PhantomJS, Chrome, IE, Firefox and others  Large community, many language bindings  Cons  Simplistic API WatiN  http://watin.org/  Pros  Fairly easy to use  Rich API (specific element types)  Cons  Supports only Internet Explorer and Firefox  Not a big community (.NET specific)
  • 14. additional SpecFlow features  Hooks  [Before/After]TestRun  [Before/After]Feature  [Before/After]Scenario  [Before/After]ScenarioBlock  [Before/After]Step  Tags/Tag Filtering on Hooks  Step Argument Conversion  [Scenario/Feature]Context  Data Tables
  • 15. additional considerations  Setting up your application database for tests  Attach/Detach database  Clear/Load database tables  Database transactions  Faking/Mocking Database  Imperative vs. Declarative tests  http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios- in-user-stories.html
  • 16. Links  Behavior-Driven Development with SpecFlow and WatiN: http://msdn.microsoft.com/en-us/magazine/gg490346.aspx  Behavior Driven Development (BDD) with SpecFlow and ASP.NET MVC: http://blog.stevensanderson.com/2010/03/03/behavior- driven-development-bdd-with-specflow-and-aspnet-mvc/

Editor's Notes

  • #10: Given-When-Then is acceptance test analog