Spec(ing) Out Your Workflow with SpecFlow
-
Upload
sarah-dutkiewicz -
Category
Technology
-
view
863 -
download
2
description
Transcript of Spec(ing) Out Your Workflow with SpecFlow
![Page 2: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/2.jpg)
Agenda
Brief Intro to ATDD & BDD
.NET Tools for ATDD & BDD
Workflow
Gherkin
SpecFlow overview
Demo
![Page 3: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/3.jpg)
What are ATDD & BDD?
ATDD → Acceptance Test Driven
Development
BDD → Behavior Driven
Development
Both build on the concepts of Test
Driven Development (TDD)
![Page 4: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/4.jpg)
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?
![Page 5: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/5.jpg)
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
![Page 6: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/6.jpg)
Two Types of BDD
xSpec
Unit test level
Includes NSpec and Machine.Specifications
xBehave
Higher level acceptance testing
Includes Nbehave and SpecFlow
![Page 7: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/7.jpg)
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
![Page 8: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/8.jpg)
Collaboration among product owners, developers,
and testers (Three Amigos)
Product owners write gherkin
Developers write code against gherkin
Testers ensure the gherkin works
![Page 9: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/9.jpg)
Collaboration Breeds Innovation
![Page 10: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/10.jpg)
.NET ATDD/BDD Tools
xBehave
StoryQ
SpecFlow
xSpec
Nspec
Machine.Specifications
![Page 11: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/11.jpg)
Workflows
Red
GreenRefactor
TDD
Specify
DevelopDeliver
ATDD
![Page 12: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/12.jpg)
Examples
RequirementsVerifyTests
![Page 13: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/13.jpg)
GherkinFeature: 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.
![Page 14: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/14.jpg)
More Gherkin – Conjunctions!
![Page 15: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/15.jpg)
SpecFlow - Platforms
Supports the following platforms:
.NET Framework
Silverlight
Windows Phone
Mono
![Page 16: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/16.jpg)
SpecFlow - Installation
MSI file for Visual Studio 2008 integration
NuGet
Visual Studio Gallery
![Page 17: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/17.jpg)
SpecFlow - Test Runner Support
Visual Studio 2012 built-in test runner
ReSharper
SpecRun
![Page 18: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/18.jpg)
SpecFlow Workflow
Specify
DevelopDeliver
ATDD• Three Amigos
• Talk about features
• Write gherkin
• Write code to fulfill
those features
• Run the feature tests
• Fix code to meet
features if they
aren’t passing.
• RetestOnce all tests past
Once all acceptance criteria
has been fulfilled
![Page 19: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/19.jpg)
DEMO
![Page 20: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/20.jpg)
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
![Page 21: Spec(ing) Out Your Workflow with SpecFlow](https://reader034.fdocuments.us/reader034/viewer/2022052321/555127ffb4c905b3598b4880/html5/thumbnails/21.jpg)
Contact Information
Twitter: @sadukie
LinkedIn: http://www.linkedin.com/profile/view?id=27521335
Email: [email protected]