spec(ing) out your workflow with specflow

21
Spec-ing out Your Workflow with SpecFlow SARAH DUTKIEWICZ [email protected]

Upload: sarah-dutkiewicz

Post on 12-May-2015

861 views

Category:

Technology


2 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Spec(ing) Out Your Workflow with SpecFlow

Spec-ing out

Your Workflow

with SpecFlowSARAH DUTKIEWICZ

[email protected]

Page 2: Spec(ing) Out Your Workflow with SpecFlow

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

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

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

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

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

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

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

Collaboration Breeds Innovation

Page 10: Spec(ing) Out Your Workflow with SpecFlow

.NET ATDD/BDD Tools

xBehave

StoryQ

SpecFlow

xSpec

Nspec

Machine.Specifications

Page 11: Spec(ing) Out Your Workflow with SpecFlow

Workflows

Red

GreenRefactor

TDD

Specify

DevelopDeliver

ATDD

Page 12: Spec(ing) Out Your Workflow with SpecFlow

Examples

RequirementsVerifyTests

Page 13: Spec(ing) Out Your Workflow with SpecFlow

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

More Gherkin – Conjunctions!

Page 15: Spec(ing) Out Your Workflow with SpecFlow

SpecFlow - Platforms

Supports the following platforms:

.NET Framework

Silverlight

Windows Phone

Mono

Page 16: Spec(ing) Out Your Workflow with SpecFlow

SpecFlow - Installation

MSI file for Visual Studio 2008 integration

NuGet

Visual Studio Gallery

Page 17: Spec(ing) Out Your Workflow with SpecFlow

SpecFlow - Test Runner Support

Visual Studio 2012 built-in test runner

ReSharper

SpecRun

Page 18: Spec(ing) Out Your Workflow with SpecFlow

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

DEMO

Page 20: Spec(ing) Out Your Workflow with SpecFlow

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

Contact Information

Twitter: @sadukie

LinkedIn: http://www.linkedin.com/profile/view?id=27521335

Email: [email protected]