SlideShare a Scribd company logo
Acceptance Test Driven Development  with SpecFlow and Friends Christopher Bartling Joel Levandoski
Contact information Christopher Bartling [email_address] Twitter:  @cbartling Joel Levandoski j [email_address] Twitter:  @joellevandoski
Administrative stuff Presentation and demo are available on BitBucket.org https://bitbucket.org/cebartling/ presentations
Topics Acceptance Test Driven Development (ATDD) SpecFlow for .NET Behavior Driven Development (BDD) tool WatiN and WebAii Live demonstration Questions
Acceptance Test Driven Development ATDD Acceptance tests are  executable specifications  of desired behavior and functionality of the system Expressed in language of the problem domain Automated Regression suite Development is driven from the  outside-in
ATDD vs. TDD TDD is extremely valuable, but you need more Achieve great unit test coverage and still not deliver value to the customer ATDD focuses on complete features and functionality ATDD: macro view  TDD: micro view
 
SpecFlow for .NET BDD testing framework Integrates nicely with Visual Studio Acceptance tests manifest themselves as features and scenarios SpecFlow generates automated test from features SpecFlow tests run as normal xUnit tests Visual Studio test runner, build server
Features Describe some piece of functionality of the system Maintained in a  .feature  file Plain readable text Understandable by all parties, including business  Gherkin format, popularized by Cucumber Features contain one or more scenarios
Feature file example Feature:  Calculate Net Present Value In order analyze the profitability of a project As a project manager I want to be able to calculate the project’s Net Present Value Scenario:  A project is rejected Given  a project to evaluate   When  data is entered reflecting a failing project ROI scenario   Then  the net present value calculator will reject the project
Scenarios A scenario describes a single acceptance test for a feature Most features are composed of multiple scenarios SpecFlow generates a test for each scenario The name of the test is generated from the scenario title
Scenario example Scenario:  A project is rejected when its NPV is    negative Given  a project to evaluate   When  data is entered reflecting a failing   ROI scenario   Then  the net present value calculator will   reject the project
Scenario steps Used to compose a scenario Custom code to automate your application Describe preconditions, triggering action, and verification of outputs for the acceptance test Given : preconditions When : triggering action Then : behavior and state verifications
Scenario step example Given   a project to evaluate is matched to the following step definition binding… [ Given ( @"a project to evaluate" )] public void GivenAProjectToEvaluate() { . . .  }
Set up and tear down Attributes for before and after events TestRun Feature Scenario, ScenarioBlock Step Specificity achieved when used with tags
Tags Markers that can be applied to features and scenarios  Useful for selectively mixing in behavior Used to categorize scenarios Some unit test frameworks support this categorization tagging Custom tags you define
Tag example @WatiN Scenario : Save valid sample size mid range Given  the user enters 10 as sample size When  the user selects save Then  the value is stored
Tag example used with BeforeScenario [ BeforeScenario (" WatiN ”)] public void BeforeScenarioUsingWatiN() { ... }
Background Common preconditions for all scenarios in a feature Contains one or more scenario steps  Executed before any other steps in the scenario SpecFlow generates a method from the background element in the feature file in the test class Invoked from each scenario test case in the test class
Background example Background : Given  that the welcome page is displayed Scenario : Add a comment to a book being    reviewed . . .
Scenario outlines Data-driven scenarios or scenario templates Consists of  Scenario template specification with data placeholders Set of examples providing values for placeholders SpecFlow generates parameterized test logic for the scenario outline and individual test method for each example set
Scenario outline example Scenario Outline : Score calculation tables Given  a new bowling game When  I roll the following series: < rolls > Then  my total score should be < total score > Examples :  |  game   |  rolls   |  total score  | | beginners game  | 2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1 | 40  | | one single spare | 2,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | 29  |
ScenarioContext ScenarioContext.Current.Pending() Causes the step definition to return pending Used to signal a stubbed step definition ScenarioContext.Current  dictionary Allows you to carry context/state across step definitions participating in scenario
WatiN Open source browser automation tool for IE and Firefox Similar to Selenium, WebDriver, Watir Browser abstraction  Find elements using CSS selectors Interact with AJAX web elements Handle popup dialogs (native and HTML)
WebAii Browser automation tool from Telerik Automates both web 2.0 and Silverlight applications HTML element wrappers WaitForElement(s) support when using AJAX Identifying elements using LINQ Invoke JavaScript directly from test code
Best practices Write high-level specifications Specifications should remain stable over time Build a scripting interface for manipulating your system under test (SUT) Focus specifications on isolated behaviors Think of specifications in  Given-When-Then  format Use the Page Object pattern
Smells Specifications are constantly changing Specifications are composed of “sequential command executions” Specifications have a lot of instrumentation or fixture code Specification examples exhibit same structure
Net Present Value Calculator Demo Used in capital budgeting Measures the excess or shortfall of cash flows, in present value terms, once financing terms have been covered Demo has two implementations ASP.NET MVC Silverlight
Questions?
Literature cited http://www.concordion.org/Technique.html http://www.telerik.com/automated-testing-tools/webaii-framework- features.aspx http://watin.org / http://www.specflow.org / http://code.google.com/p/selenium/wiki/ PageObjects
Ad

More Related Content

What's hot (20)

Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
Steven Mak
 
SpecFlow for Agile Teams
SpecFlow for Agile TeamsSpecFlow for Agile Teams
SpecFlow for Agile Teams
Alejandro Ramirez
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlow
Sarah Dutkiewicz
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
Jason Harmon
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
ATDD in practice
ATDD in practiceATDD in practice
ATDD in practice
Andrei Marukovich
 
SpecFlow Executable Specifications
SpecFlow Executable SpecificationsSpecFlow Executable Specifications
SpecFlow Executable Specifications
Sam Leach
 
Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
Abhimanyu Singhal
 
Automated Acceptance Tests in .NET
Automated Acceptance Tests in .NETAutomated Acceptance Tests in .NET
Automated Acceptance Tests in .NET
Wyn B. Van Devanter
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
Tung Nguyen Thanh
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
temebele
 
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
XPDays
 
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
Daniel Davis
 
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
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
Arvind Vyas
 
Journey of atdd
Journey of atddJourney of atdd
Journey of atdd
Devesh Maheshwari
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
toteb5
 
Serenity-BDD training
Serenity-BDD trainingSerenity-BDD training
Serenity-BDD training
Savvycom Savvycom
 
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAUTest Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
InfinIT - Innovationsnetværket for it
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
Liraz Shay
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
Steven Mak
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlow
Sarah Dutkiewicz
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
SpecFlow Executable Specifications
SpecFlow Executable SpecificationsSpecFlow Executable Specifications
SpecFlow Executable Specifications
Sam Leach
 
Automated Acceptance Tests in .NET
Automated Acceptance Tests in .NETAutomated Acceptance Tests in .NET
Automated Acceptance Tests in .NET
Wyn B. Van Devanter
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
Tung Nguyen Thanh
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
temebele
 
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
XPDays
 
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
Daniel Davis
 
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
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
Liraz Shay
 

Viewers also liked (20)

Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven Development
John Ferguson Smart Limited
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
Elisabeth Hendrickson
 
Acceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycleAcceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycle
Giuseppe Torchia
 
CloudSpokes Overview
CloudSpokes OverviewCloudSpokes Overview
CloudSpokes Overview
Jeff Douglas
 
Specflow - Criando uma ponte entre desenvolvedores.
Specflow - Criando uma ponte entre desenvolvedores.Specflow - Criando uma ponte entre desenvolvedores.
Specflow - Criando uma ponte entre desenvolvedores.
Franklin Araujo SMAC™ ASTAC™ SFC™
 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014
jaredrrichardson
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with Fitnesse
ClareMcLennan
 
Writing Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using FitnesseWriting Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using Fitnesse
Facundo Farias
 
How To Fit Testing Into The Iteration
How To Fit Testing Into The IterationHow To Fit Testing Into The Iteration
How To Fit Testing Into The Iteration
Rally Software
 
Writing Effective User Stories
Writing Effective User StoriesWriting Effective User Stories
Writing Effective User Stories
Janeve George
 
Acceptance Criteria with SpecFlow
Acceptance Criteria with SpecFlowAcceptance Criteria with SpecFlow
Acceptance Criteria with SpecFlow
Marcin Floryan
 
Tech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagyTech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagy
Skills Matter
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlow
Christian Hassa
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot Framework
Pekka Klärck
 
Writing GREAT Agile User Stories
Writing GREAT Agile User StoriesWriting GREAT Agile User Stories
Writing GREAT Agile User Stories
AgileDad
 
ATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven DevelopmentATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven Development
Naresh Jain
 
Writing Effective User Stories
Writing Effective User StoriesWriting Effective User Stories
Writing Effective User Stories
Carlo Kruger
 
Agile User Stories
Agile User StoriesAgile User Stories
Agile User Stories
kahgeh75
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 
Rt acceptance criteria by zas
Rt acceptance  criteria by zasRt acceptance  criteria by zas
Rt acceptance criteria by zas
zaheer sajid
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
Elisabeth Hendrickson
 
Acceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycleAcceptance test driven development (attd) cycle
Acceptance test driven development (attd) cycle
Giuseppe Torchia
 
CloudSpokes Overview
CloudSpokes OverviewCloudSpokes Overview
CloudSpokes Overview
Jeff Douglas
 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014
jaredrrichardson
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with Fitnesse
ClareMcLennan
 
Writing Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using FitnesseWriting Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using Fitnesse
Facundo Farias
 
How To Fit Testing Into The Iteration
How To Fit Testing Into The IterationHow To Fit Testing Into The Iteration
How To Fit Testing Into The Iteration
Rally Software
 
Writing Effective User Stories
Writing Effective User StoriesWriting Effective User Stories
Writing Effective User Stories
Janeve George
 
Acceptance Criteria with SpecFlow
Acceptance Criteria with SpecFlowAcceptance Criteria with SpecFlow
Acceptance Criteria with SpecFlow
Marcin Floryan
 
Tech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagyTech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagy
Skills Matter
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlow
Christian Hassa
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot Framework
Pekka Klärck
 
Writing GREAT Agile User Stories
Writing GREAT Agile User StoriesWriting GREAT Agile User Stories
Writing GREAT Agile User Stories
AgileDad
 
ATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven DevelopmentATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven Development
Naresh Jain
 
Writing Effective User Stories
Writing Effective User StoriesWriting Effective User Stories
Writing Effective User Stories
Carlo Kruger
 
Agile User Stories
Agile User StoriesAgile User Stories
Agile User Stories
kahgeh75
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 
Rt acceptance criteria by zas
Rt acceptance  criteria by zasRt acceptance  criteria by zas
Rt acceptance criteria by zas
zaheer sajid
 
Ad

Similar to Acceptance Test Driven Development With Spec Flow And Friends (20)

About Qtp 92
About Qtp 92About Qtp 92
About Qtp 92
techgajanan
 
About Qtp_1 92
About Qtp_1 92About Qtp_1 92
About Qtp_1 92
techgajanan
 
About QTP 9.2
About QTP 9.2About QTP 9.2
About QTP 9.2
chandrasekhar
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
mehramit
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
Antonio Radesca
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
 
QTP AUTOMATION TESTING SYLLABUS
QTP AUTOMATION TESTING SYLLABUSQTP AUTOMATION TESTING SYLLABUS
QTP AUTOMATION TESTING SYLLABUS
SHPINE TECHNOLOGIES
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
VenkateswaraRao Siddabathula
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Qtp Presentation
Qtp PresentationQtp Presentation
Qtp Presentation
techgajanan
 
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed KhanJavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
troestepza
 
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed KhanJavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
malacorigert
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
davejohnson
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks Final
Margaret_Dickman
 
Automating Software Communications Architecture (SCA) Testing with Spectra CX
Automating Software Communications Architecture (SCA) Testing with Spectra CXAutomating Software Communications Architecture (SCA) Testing with Spectra CX
Automating Software Communications Architecture (SCA) Testing with Spectra CX
ADLINK Technology IoT
 
Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)
raj.kamal13
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
Testing tools concepts
Testing tools conceptsTesting tools concepts
Testing tools concepts
Krishna Gurjar
 
Qtp syllabus
Qtp syllabus Qtp syllabus
Qtp syllabus
Rohit Chintu
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
justmeanscsr
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
mehramit
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Qtp Presentation
Qtp PresentationQtp Presentation
Qtp Presentation
techgajanan
 
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed KhanJavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
troestepza
 
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed KhanJavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
JavaScript for NET Developers 1st Edition Ovais Mehboob Ahmed Khan
malacorigert
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
davejohnson
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks Final
Margaret_Dickman
 
Automating Software Communications Architecture (SCA) Testing with Spectra CX
Automating Software Communications Architecture (SCA) Testing with Spectra CXAutomating Software Communications Architecture (SCA) Testing with Spectra CX
Automating Software Communications Architecture (SCA) Testing with Spectra CX
ADLINK Technology IoT
 
Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)Rational Robot (http://www.geektester.blogspot.com)
Rational Robot (http://www.geektester.blogspot.com)
raj.kamal13
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
Testing tools concepts
Testing tools conceptsTesting tools concepts
Testing tools concepts
Krishna Gurjar
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
justmeanscsr
 
Ad

More from Christopher Bartling (12)

JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
Christopher Bartling
 
Acceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmAcceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvm
Christopher Bartling
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
Christopher Bartling
 
Building Tropo Apps with Grails
Building Tropo Apps with GrailsBuilding Tropo Apps with Grails
Building Tropo Apps with Grails
Christopher Bartling
 
CoffeeScript By Example
CoffeeScript By ExampleCoffeeScript By Example
CoffeeScript By Example
Christopher Bartling
 
Introduction To Grails
Introduction To GrailsIntroduction To Grails
Introduction To Grails
Christopher Bartling
 
Cucumber, Cuke4Duke, and Groovy
Cucumber, Cuke4Duke, and GroovyCucumber, Cuke4Duke, and Groovy
Cucumber, Cuke4Duke, and Groovy
Christopher Bartling
 
Test Driven In Groovy
Test Driven In GroovyTest Driven In Groovy
Test Driven In Groovy
Christopher Bartling
 
iPhone OS: The Next Killer Platform
iPhone OS: The Next Killer PlatformiPhone OS: The Next Killer Platform
iPhone OS: The Next Killer Platform
Christopher Bartling
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
Christopher Bartling
 
Grails Overview
Grails OverviewGrails Overview
Grails Overview
Christopher Bartling
 
Rich Web Clients 20081118
Rich Web Clients 20081118Rich Web Clients 20081118
Rich Web Clients 20081118
Christopher Bartling
 

Acceptance Test Driven Development With Spec Flow And Friends

  • 1. Acceptance Test Driven Development with SpecFlow and Friends Christopher Bartling Joel Levandoski
  • 2. Contact information Christopher Bartling [email_address] Twitter: @cbartling Joel Levandoski j [email_address] Twitter: @joellevandoski
  • 3. Administrative stuff Presentation and demo are available on BitBucket.org https://bitbucket.org/cebartling/ presentations
  • 4. Topics Acceptance Test Driven Development (ATDD) SpecFlow for .NET Behavior Driven Development (BDD) tool WatiN and WebAii Live demonstration Questions
  • 5. Acceptance Test Driven Development ATDD Acceptance tests are executable specifications of desired behavior and functionality of the system Expressed in language of the problem domain Automated Regression suite Development is driven from the outside-in
  • 6. ATDD vs. TDD TDD is extremely valuable, but you need more Achieve great unit test coverage and still not deliver value to the customer ATDD focuses on complete features and functionality ATDD: macro view TDD: micro view
  • 7.  
  • 8. SpecFlow for .NET BDD testing framework Integrates nicely with Visual Studio Acceptance tests manifest themselves as features and scenarios SpecFlow generates automated test from features SpecFlow tests run as normal xUnit tests Visual Studio test runner, build server
  • 9. Features Describe some piece of functionality of the system Maintained in a .feature file Plain readable text Understandable by all parties, including business Gherkin format, popularized by Cucumber Features contain one or more scenarios
  • 10. Feature file example Feature: Calculate Net Present Value In order analyze the profitability of a project As a project manager I want to be able to calculate the project’s Net Present Value Scenario: A project is rejected Given a project to evaluate When data is entered reflecting a failing project ROI scenario Then the net present value calculator will reject the project
  • 11. Scenarios A scenario describes a single acceptance test for a feature Most features are composed of multiple scenarios SpecFlow generates a test for each scenario The name of the test is generated from the scenario title
  • 12. Scenario example Scenario: A project is rejected when its NPV is negative Given a project to evaluate When data is entered reflecting a failing ROI scenario Then the net present value calculator will reject the project
  • 13. Scenario steps Used to compose a scenario Custom code to automate your application Describe preconditions, triggering action, and verification of outputs for the acceptance test Given : preconditions When : triggering action Then : behavior and state verifications
  • 14. Scenario step example Given a project to evaluate is matched to the following step definition binding… [ Given ( @&quot;a project to evaluate&quot; )] public void GivenAProjectToEvaluate() { . . . }
  • 15. Set up and tear down Attributes for before and after events TestRun Feature Scenario, ScenarioBlock Step Specificity achieved when used with tags
  • 16. Tags Markers that can be applied to features and scenarios Useful for selectively mixing in behavior Used to categorize scenarios Some unit test frameworks support this categorization tagging Custom tags you define
  • 17. Tag example @WatiN Scenario : Save valid sample size mid range Given the user enters 10 as sample size When the user selects save Then the value is stored
  • 18. Tag example used with BeforeScenario [ BeforeScenario (&quot; WatiN ”)] public void BeforeScenarioUsingWatiN() { ... }
  • 19. Background Common preconditions for all scenarios in a feature Contains one or more scenario steps Executed before any other steps in the scenario SpecFlow generates a method from the background element in the feature file in the test class Invoked from each scenario test case in the test class
  • 20. Background example Background : Given that the welcome page is displayed Scenario : Add a comment to a book being reviewed . . .
  • 21. Scenario outlines Data-driven scenarios or scenario templates Consists of Scenario template specification with data placeholders Set of examples providing values for placeholders SpecFlow generates parameterized test logic for the scenario outline and individual test method for each example set
  • 22. Scenario outline example Scenario Outline : Score calculation tables Given a new bowling game When I roll the following series: < rolls > Then my total score should be < total score > Examples : | game | rolls | total score | | beginners game | 2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1 | 40 | | one single spare | 2,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | 29 |
  • 23. ScenarioContext ScenarioContext.Current.Pending() Causes the step definition to return pending Used to signal a stubbed step definition ScenarioContext.Current dictionary Allows you to carry context/state across step definitions participating in scenario
  • 24. WatiN Open source browser automation tool for IE and Firefox Similar to Selenium, WebDriver, Watir Browser abstraction Find elements using CSS selectors Interact with AJAX web elements Handle popup dialogs (native and HTML)
  • 25. WebAii Browser automation tool from Telerik Automates both web 2.0 and Silverlight applications HTML element wrappers WaitForElement(s) support when using AJAX Identifying elements using LINQ Invoke JavaScript directly from test code
  • 26. Best practices Write high-level specifications Specifications should remain stable over time Build a scripting interface for manipulating your system under test (SUT) Focus specifications on isolated behaviors Think of specifications in Given-When-Then format Use the Page Object pattern
  • 27. Smells Specifications are constantly changing Specifications are composed of “sequential command executions” Specifications have a lot of instrumentation or fixture code Specification examples exhibit same structure
  • 28. Net Present Value Calculator Demo Used in capital budgeting Measures the excess or shortfall of cash flows, in present value terms, once financing terms have been covered Demo has two implementations ASP.NET MVC Silverlight
  • 30. Literature cited http://www.concordion.org/Technique.html http://www.telerik.com/automated-testing-tools/webaii-framework- features.aspx http://watin.org / http://www.specflow.org / http://code.google.com/p/selenium/wiki/ PageObjects