Your SlideShare is downloading. ×
Behavior Driven Development
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Behavior Driven Development

494
views

Published on

Automated Acceptance Criteria using SpecFlow with Selenium in .NET

Automated Acceptance Criteria using SpecFlow with Selenium in .NET

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
494
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Given-When-Then is acceptance test analog
  • Transcript

    • 1. behavior drivendevelopment in.NETMICHAEL MCGUIRE@MONOCULARVISION
    • 2. so what’s theproblem?
    • 3. 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 ofworking, tested software that matters.”- Dan North
    • 4. 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
    • 5. 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 (SingleResponsibility Principle) Acceptance criteria should be executable Requirements are behavior too!
    • 6. TDDMake ItPassRefactorWriteFailingUnit Test
    • 7. BDD is TDDMake ItPassRefactorWriteFailingUnit TestWrite FailingAcceptanceTestMake It Pass
    • 8. 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
    • 9.  http://www.specflow.org/ Open source framework for the creation and execution ofautomated acceptance tests in .NET Uses the Gherkin syntax for defining features and scenarios Generates NUnit or MSTest unit tests from feature file
    • 10. SpecFlow Demo
    • 11. driving your applicationSelenium http://seleniumhq.org Pros Most major browsers supported -PhantomJS, Chrome, IE, Firefoxand others Large community, many languagebindings Cons Simplistic APIWatiN http://watin.org/ Pros Fairly easy to use Rich API (specific element types) Cons Supports only Internet Explorer andFirefox Not a big community (.NETspecific)
    • 12. Selenium + SpecFlow Demo
    • 13. 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
    • 14. 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
    • 15. 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.NETMVC: http://blog.stevensanderson.com/2010/03/03/behavior-driven-development-bdd-with-specflow-and-aspnet-mvc/