SlideShare uma empresa Scribd logo
SpecFlow ‘functional testing made easy’Twitter: @stack72Email: public@paulstack.co.ukBlog: http://paulstack.co.uk/blog
Agenda A look at ‘traditional testing’ Introduction to BDD ‘Testing Pyramid’ BDD Tools Introduction to WatiN The Marriage of SpecFlow and WatiN
Traditional Testing Ethos Kent Beck introduced us to what testing should be in late 1990’s It was the first real indication that testing should be part of the software development lifecycle Unit Tests smallest testable part of an application - e.g. method or function programmer writes as many tests as they can think of that might "break" the code every piece of code that is written will have tests for it Acceptance Tests can be broken down to smoke tests, user acceptance tests and integration tests verify that requirements as understood by developers satisfy the customers requirements This led to practices like TDD
What is TDD? Write a test beforewriting the production code Make a minimal change to the production code to make the test pass Refactor the code to make it better  Advantages Provides a form of documentation Also provides a safety net when code changes Questions? Where do we start? What is a good enough test? How does this relate to the user stories?
Test Driven Development Cycle
How should these change? March 2006 – Dan North (@Tastapod) he discusses he had a problem with traditional TDD and that he ran into the same problems all other developers ran into - where to start, what to test and what not to test he decided to represent TDD in a way to avoid the pitfalls and get straight to the good stuff The article was called – “Introducing BDD”
BDD Key points Test method names should be sentences A simple sentence template keeps test methods focused An expressive test name is helpful when a test fails “Behaviour” is a more useful word than “test” Requirements are behaviour BDD provides a “ubiquitous language” for analysis (GWT) Acceptance criteria should be executable
Behavioural Driven Development Cycle
How do acceptance tests and unit tests work with each other?
BDD Testing Tools
Different Tools + MSpec, Rspec, Cuke4Nuke etc…
What is SpecFlow? SpecFlow is a .Net tool that lets you write specifications / user stories in plain readable Gherkin format It integrates with Visual Studio, which means you get File->New templates for creating new feature files Gives VS debugger support, so you can set breakpoints on Given/When/Then lines in your .feature files and step through their execution When you compile a project containing SpecFlow feature files, the output is an NUnit test assembly, so you can use your favourite NUnit-compatible test runner or existing CI infrastructure to run the specifications with no additional configuration.
SpecFlow basically turns this type of business level detail: General rules for entering leader boards Usernames need to be checked for profanities before publication. Users will always be asked to post their scores to the leader boards, they won't be done automatically. A user has to complete at least one question correctly to be eligible to be added to the leader board. Users who don't post their scores to the leader board will not appear in any of the leader board stats. A user cannot post their score to the leader board without logging in or registering. Even if  a user hasn't submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.
Into this level of breakdown: Given a user wants to post their score to a leader board When they have registered the nickname ‘knobhead’ Then that nickname fails the profanity test Given a user wants to post their score to a leader board When they have registered the nickname ‘QuizStar’ Then that nickname passes the profanity test
General rules for entering leader boards Usernames need to be checked for profanities before publication. Users will always be asked to post their scores to the leader boards, they won't be done automatically. A user has to complete at least one question correctly to be eligible to be added to the leader board. Users who don't post their scores to the leader board will not appear in any of the leader board stats. A user cannot post their score to the leader board without logging in or registering. Even if  a user hasn't submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.
Given a user finishes a quiz When the user is not logged in Then the user is offered the chance to enter the leader board And the post to leader board button redirects to login page Given a user finishes a quiz When the user is logged in Then the user is offered the chance to enter the leader board 	And the post to leader board button returns successful entry
BDD Testing Tools
WatiN
What is WatiN? Open source API (watin.org) that actually uses the browser for testing NOT emulating it Integrates with Visual Studio so tests can be debugged The most impressive feature of WatiN is the level of access you have to the DOM. Web tests are able to find elements by id, index, name, text, CSS class, etc., iterate through collections of elements, and invoke any event.
Front End Testing – Good Practice? Everything should be tested BUT we need to remember a few things when testing the UI UI tests: Can be brittle Can take time Should not replace unit and integration tests Should not be taken as 100% gospel truth
Demo…..
Summary We have looked at: Traditional testing ethos Emergence of BDD SpecFlow as a BDD tool WatiN as a testing tool SpecFlow + WatiN – Marriage made in heaven
Questions…..??
Thanks!  Twitter: @stack72 Email: public@paulstack.co.uk Blog: http://paulstack.co.uk/blog

Mais conteúdo relacionado

Mais procurados

Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
toteb5
 
Writing Testable Code
Writing Testable CodeWriting Testable Code
Writing Testable Code
jameshalsall
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
Babul Mirdha
 

Mais procurados (20)

BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Introduction to TDD and BDD
Introduction to TDD and BDDIntroduction to TDD and BDD
Introduction to TDD and BDD
 
Introduction to BDD
Introduction to BDDIntroduction to BDD
Introduction to BDD
 
BDD in Action - building software that matters
BDD in Action - building software that mattersBDD in Action - building software that matters
BDD in Action - building software that matters
 
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UXBehaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
Behaviour Driven Development (BDD) - Closing the Loop on a Great Fiori UX
 
TDD and BDD and ATDD
TDD and BDD and ATDDTDD and BDD and ATDD
TDD and BDD and ATDD
 
BDD-Driven Microservices
BDD-Driven MicroservicesBDD-Driven Microservices
BDD-Driven Microservices
 
Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!
 
ATDD in Practice
ATDD in PracticeATDD in Practice
ATDD in Practice
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
BDD in Action - Automated Web Testing with WebDriver and Serenity
BDD in Action - Automated Web Testing with WebDriver and SerenityBDD in Action - Automated Web Testing with WebDriver and Serenity
BDD in Action - Automated Web Testing with WebDriver and Serenity
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
Tech talks #1- Unit testing and TDD
Tech talks #1- Unit testing and TDDTech talks #1- Unit testing and TDD
Tech talks #1- Unit testing and 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)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
 
Serenity-BDD training
Serenity-BDD trainingSerenity-BDD training
Serenity-BDD training
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
 
Writing Testable Code
Writing Testable CodeWriting Testable Code
Writing Testable Code
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
Test Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetupTest Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetup
 

Destaque

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 with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
Brandon Keepers
 
Functional specification
Functional specificationFunctional specification
Functional specification
vurimi prasad
 
The Dark Side of Code Metrics
The Dark Side of Code MetricsThe Dark Side of Code Metrics
The Dark Side of Code Metrics
Donald Belcham
 
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrhTransparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Hichem Chehida
 
Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012 Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012
OzlemYuce
 

Destaque (20)

Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
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 with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
Functional specification
Functional specificationFunctional specification
Functional specification
 
BDD with JBehave
BDD with JBehaveBDD with JBehave
BDD with JBehave
 
Specflow: Specification by Example
Specflow: Specification by ExampleSpecflow: Specification by Example
Specflow: Specification by Example
 
BDD using JBehave
BDD using JBehaveBDD using JBehave
BDD using JBehave
 
A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0
 
Kanban in sw development
Kanban in sw developmentKanban in sw development
Kanban in sw development
 
The Dark Side of Code Metrics
The Dark Side of Code MetricsThe Dark Side of Code Metrics
The Dark Side of Code Metrics
 
StarEast2013 - kanban for test teams
StarEast2013 - kanban for test teamsStarEast2013 - kanban for test teams
StarEast2013 - kanban for test teams
 
Introduction to kanban
Introduction to kanbanIntroduction to kanban
Introduction to kanban
 
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrhTransparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
 
How to Get Started with Kanban, and Why
How to Get Started with Kanban, and WhyHow to Get Started with Kanban, and Why
How to Get Started with Kanban, and Why
 
Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012 Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012
 
Combating entropy in business
Combating entropy in businessCombating entropy in business
Combating entropy in business
 
Mvvm basics
Mvvm basicsMvvm basics
Mvvm basics
 
Gherkin for test automation in agile
Gherkin for test automation in agileGherkin for test automation in agile
Gherkin for test automation in agile
 
Identifying and managing waste in software product development
Identifying and managing waste in software product developmentIdentifying and managing waste in software product development
Identifying and managing waste in software product development
 
Kanban 101 - 3 - Kanban Essentials
Kanban 101 - 3 - Kanban EssentialsKanban 101 - 3 - Kanban Essentials
Kanban 101 - 3 - Kanban Essentials
 

Semelhante a Spec flow – functional testing made easy

CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWD
Vikas Sarin
 
Code Review
Code ReviewCode Review
Code Review
Ravi Raj
 
BDD approach with Selenium RC
BDD approach with Selenium RCBDD approach with Selenium RC
BDD approach with Selenium RC
Mykola Kolisnyk
 

Semelhante a Spec flow – functional testing made easy (20)

CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWD
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
 
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
 
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd   seven years afterIan Cooper webinar for DDD Iran: Kent beck style tdd   seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
 
Code Review
Code ReviewCode Review
Code Review
 
The Essentials Of Test Driven Development
The Essentials Of Test Driven Development The Essentials Of Test Driven Development
The Essentials Of Test Driven Development
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
BDD approach with Selenium RC
BDD approach with Selenium RCBDD approach with Selenium RC
BDD approach with Selenium RC
 
Presentation_TDD
Presentation_TDDPresentation_TDD
Presentation_TDD
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Agile testing
Agile testingAgile testing
Agile testing
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
General technical interview questions
General technical interview questionsGeneral technical interview questions
General technical interview questions
 
Software presentation
Software presentationSoftware presentation
Software presentation
 
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
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010
 
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual StudioSPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
 

Mais de Paul Stack (6)

Vagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a toolVagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a tool
 
Puppet powershell
Puppet powershellPuppet powershell
Puppet powershell
 
Vagrant: The ability to create production environments from day 1 of development
Vagrant: The ability to create production environments from day 1 of developmentVagrant: The ability to create production environments from day 1 of development
Vagrant: The ability to create production environments from day 1 of development
 
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConfWindows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
 
Windows: Having it's ass kicked by Puppet and PowerShell since 2012
Windows: Having it's ass kicked by Puppet and PowerShell since 2012Windows: Having it's ass kicked by Puppet and PowerShell since 2012
Windows: Having it's ass kicked by Puppet and PowerShell since 2012
 
Beginners Guide to CI
Beginners Guide to CIBeginners Guide to CI
Beginners Guide to CI
 

Último

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Último (20)

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 

Spec flow – functional testing made easy

  • 1. SpecFlow ‘functional testing made easy’Twitter: @stack72Email: public@paulstack.co.ukBlog: http://paulstack.co.uk/blog
  • 2. Agenda A look at ‘traditional testing’ Introduction to BDD ‘Testing Pyramid’ BDD Tools Introduction to WatiN The Marriage of SpecFlow and WatiN
  • 3. Traditional Testing Ethos Kent Beck introduced us to what testing should be in late 1990’s It was the first real indication that testing should be part of the software development lifecycle Unit Tests smallest testable part of an application - e.g. method or function programmer writes as many tests as they can think of that might "break" the code every piece of code that is written will have tests for it Acceptance Tests can be broken down to smoke tests, user acceptance tests and integration tests verify that requirements as understood by developers satisfy the customers requirements This led to practices like TDD
  • 4. What is TDD? Write a test beforewriting the production code Make a minimal change to the production code to make the test pass Refactor the code to make it better Advantages Provides a form of documentation Also provides a safety net when code changes Questions? Where do we start? What is a good enough test? How does this relate to the user stories?
  • 6. How should these change? March 2006 – Dan North (@Tastapod) he discusses he had a problem with traditional TDD and that he ran into the same problems all other developers ran into - where to start, what to test and what not to test he decided to represent TDD in a way to avoid the pitfalls and get straight to the good stuff The article was called – “Introducing BDD”
  • 7. BDD Key points Test method names should be sentences A simple sentence template keeps test methods focused An expressive test name is helpful when a test fails “Behaviour” is a more useful word than “test” Requirements are behaviour BDD provides a “ubiquitous language” for analysis (GWT) Acceptance criteria should be executable
  • 9. How do acceptance tests and unit tests work with each other?
  • 10.
  • 11.
  • 13. Different Tools + MSpec, Rspec, Cuke4Nuke etc…
  • 14. What is SpecFlow? SpecFlow is a .Net tool that lets you write specifications / user stories in plain readable Gherkin format It integrates with Visual Studio, which means you get File->New templates for creating new feature files Gives VS debugger support, so you can set breakpoints on Given/When/Then lines in your .feature files and step through their execution When you compile a project containing SpecFlow feature files, the output is an NUnit test assembly, so you can use your favourite NUnit-compatible test runner or existing CI infrastructure to run the specifications with no additional configuration.
  • 15. SpecFlow basically turns this type of business level detail: General rules for entering leader boards Usernames need to be checked for profanities before publication. Users will always be asked to post their scores to the leader boards, they won't be done automatically. A user has to complete at least one question correctly to be eligible to be added to the leader board. Users who don't post their scores to the leader board will not appear in any of the leader board stats. A user cannot post their score to the leader board without logging in or registering. Even if  a user hasn't submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.
  • 16. Into this level of breakdown: Given a user wants to post their score to a leader board When they have registered the nickname ‘knobhead’ Then that nickname fails the profanity test Given a user wants to post their score to a leader board When they have registered the nickname ‘QuizStar’ Then that nickname passes the profanity test
  • 17. General rules for entering leader boards Usernames need to be checked for profanities before publication. Users will always be asked to post their scores to the leader boards, they won't be done automatically. A user has to complete at least one question correctly to be eligible to be added to the leader board. Users who don't post their scores to the leader board will not appear in any of the leader board stats. A user cannot post their score to the leader board without logging in or registering. Even if  a user hasn't submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.
  • 18. Given a user finishes a quiz When the user is not logged in Then the user is offered the chance to enter the leader board And the post to leader board button redirects to login page Given a user finishes a quiz When the user is logged in Then the user is offered the chance to enter the leader board And the post to leader board button returns successful entry
  • 20. WatiN
  • 21. What is WatiN? Open source API (watin.org) that actually uses the browser for testing NOT emulating it Integrates with Visual Studio so tests can be debugged The most impressive feature of WatiN is the level of access you have to the DOM. Web tests are able to find elements by id, index, name, text, CSS class, etc., iterate through collections of elements, and invoke any event.
  • 22. Front End Testing – Good Practice? Everything should be tested BUT we need to remember a few things when testing the UI UI tests: Can be brittle Can take time Should not replace unit and integration tests Should not be taken as 100% gospel truth
  • 24. Summary We have looked at: Traditional testing ethos Emergence of BDD SpecFlow as a BDD tool WatiN as a testing tool SpecFlow + WatiN – Marriage made in heaven
  • 26. Thanks! Twitter: @stack72 Email: public@paulstack.co.uk Blog: http://paulstack.co.uk/blog