Spec(ing) Out Your Workflow with SpecFlow


Published on

Presented at the Cleveland WPF User Group on October 16, 2012

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Spec(ing) Out Your Workflow with SpecFlow

  1. 1. Spec-ing outYour Workflowwith SpecFlow SARAH DUTKIEWICZ SARAH@CLETECHCONSULTING.COM
  2. 2. Agenda  Brief Intro to ATDD & BDD  .NET Tools for ATDD & BDD  Workflow  Gherkin  SpecFlow overview  Demo
  3. 3. What are ATDD & BDD? ATDD → Acceptance Test Driven Development BDD → Behavior Driven Development Both build on the concepts of Test Driven Development (TDD)
  4. 4. Behavior Driven Development  Goes beyond unit testing and looks at the system as a whole  Top down/ outside in  Describes how the application is going to be used through executable examples  The question is “What’s the intended behavior?”  What should it do?
  5. 5. BDD Guidelines  Test method names should be sentences – helpful for finding failing tests and understand what the behavior class does  Use “behavior” instead of “test”  Requirements are considered behaviors  Ubiquitous language (gherkin)  As a … I want… so that …  Given… When… Then  Criteria should be executable
  6. 6. Two Types of BDD  xSpec  Unit test level  Includes NSpec and Machine.Specifications  xBehave  Higher level acceptance testing  Includes Nbehave and SpecFlow
  7. 7. ATDD  Subset of BDD, focusing on the acceptance criteria  Criteria first, then tests written, then code  Document that describes the behaviors in the system  Detail out the specification – specific business rules and any other specifics to help devs understand  Defects are discovered quicker – in discussing the acceptance criteria rather than waiting for testing  High level examples of how the software will be used
  8. 8. Collaboration among product owners, developers,and testers (Three Amigos) Product owners write gherkin Developers write code against gherkin Testers ensure the gherkin works
  9. 9. Collaboration Breeds Innovation
  10. 10. .NET ATDD/BDD Tools  xBehave  StoryQ  SpecFlow  xSpec  Nspec  Machine.Specifications
  11. 11. Workflows TDD Red ATDD Specify Refactor Green Deliver Develop
  12. 12. ExamplesTests Verify Requirements
  13. 13. Gherkin Feature: Collaboration In order to ensure successful product development, I want to collaborate with the team in all phases. Scenario: The Goal of the Product Owner Given I am the Product Owner When I write feature files Then developers and testers have documentation to help ensure that the product is what I want. Scenario: The Goal of the Developer Given I am the Developer When I have the feature files Then I can write the code for those features Scenario: The Goal of the Tester Given I am the Tester When the Developer is done writing the code for a feature Then I can test the code to make sure it fulfills that feature’s requirements.
  14. 14. More Gherkin – Conjunctions!
  15. 15. SpecFlow - Platforms  Supports the following platforms:  .NET Framework  Silverlight  Windows Phone  Mono
  16. 16. SpecFlow - Installation  MSI file for Visual Studio 2008 integration  NuGet  Visual Studio Gallery
  17. 17. SpecFlow - Test Runner Support  Visual Studio 2012 built-in test runner  ReSharper  SpecRun
  18. 18. SpecFlow Workflow • Three Amigos ATDD • Talk about features Specify • Write gherkin • Write code to fulfill those features • Run the feature tests Deliver Develop • Fix code to meet features if they aren’t passing. Once all tests past • Retest Once all acceptance criteria has been fulfilled
  19. 19. DEMO
  20. 20. Resources  Gherkin  Cucumber Project Documentation on GitHub  Books  Cucumber & Cheese: A Testers Workshop by Jeff Morgan  The Cucumber Book: Behaviour-Driven Development for Testers and Developers by Matt Wynne and Aslak Hellesøy  Specification by Example by Gojko Adzic  SpecFlow  C# ATDD on a shoestring (or the complete guide to SpecFlow & Nunit in Visual Studio 2010 Express) on WatirMelon by Alister Scott
  21. 21. Contact Information  Twitter: @sadukie  LinkedIn: http://www.linkedin.com/profile/view?id=27521335  Email: sarah@cletechconsulting.com