behavior driven development in the real world l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Behavior Driven Development in the Real World PowerPoint Presentation
Download Presentation
Behavior Driven Development in the Real World

Loading in 2 Seconds...

play fullscreen
1 / 22

Behavior Driven Development in the Real World - PowerPoint PPT Presentation


  • 352 Views
  • Uploaded on

Required Slide. SESSION CODE: DPR302. Behavior Driven Development in the Real World. David Starr Pluralsight Instructor ALM Consultant Visual Studio ALM MVP. starr@pluralsight.com Blog: ElegantCode.com @ elegantcoder. In This Session. Conversations About Software

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Behavior Driven Development in the Real World' - tanisha


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
behavior driven development in the real world

Required Slide

SESSION CODE: DPR302

Behavior Driven Development in the Real World

David Starr

Pluralsight Instructor

ALM Consultant

Visual Studio ALM MVP

starr@pluralsight.com

Blog: ElegantCode.com

@elegantcoder

in this session
In This Session
  • Conversations About Software
  • Expressing Desirements Well
  • Making Requirements from Desirements
  • Specification in Context
  • BDD Tools
communication is still a big problem
Communication is Still a Big Problem
  • So we use specifications
    • Use Cases
    • UML diagrams and models
    • Numerous large document models
  • Specification and Requirements
    • Can be expensive to produce
    • Good enough often preferred to perfect
    • Must evolve easily as the software does

This isn’t what I thought

we agreed on.

draw it first
Draw It First
  • Users think at this level
  • Software has behavior at this level
  • UI elements give us something to discuss

Paper

Whiteboards

Visio

PowerPoint

SketchFlow

expressing desirements
Expressing Desirements
  • User Stories represent needed conversations

As a <application role>

I want <some feature or behavior>

So that <I get some benefit>

  • Scenarios document the conversation took place

Given <some initial context>

When <this happens>

Then <this should be the result>

Desirements are things we wish the software did.

But it doesn’t. Yet.

a complete user story
A Complete User Story

Story: Remove Item From Shopping Cart

As aCustomer with Products in my Cart I wantto remove an ItemSo I canchange my mind about buying it

Scenario: Multiple Items in CartGiven a Cart with multiple Items in itWhen 1 Item is removedThen the other Items are still in the Cart

And the Cart Item Count is correct

And the Cart Subtotal reflects the remaining Items

scenarios work at many levels
Scenarios Work at Many Levels

Customer

Domain Concepts

UI Element Behavior

Input Validation

Services

Class Behavior

Repositories

Developer

making requirements from desirements
Making Requirements from Desirements
  • Executable Specifications

Expressing requirements such that they are also tests

Because Microsoft Word documents can’t prove software works

  • Sweet Aromas of Executable Specifications
    • Meaningful to all interested parties
    • Unambiguously demonstrate if the requirement is met
    • Drive out a testable design
    • Simple
using executable specifications
Using Executable Specifications

As a

I want

So that

As a

I want

So that

  • Make tests that read as Desirements
  • Tests fail against the SUT
  • Tests pass against the SUT
  • Discuss results with customer
  • Add more and refine as conversations occur

Given

When

Then

Given

When

Then

Given

When

Then

Given

When

Then

Given

When

Then

Given

When

Then

1 2 3
1, 2, 3

[TestMethod]

public void

Total_Should_Be_1_When_1_Product_Added()

{

var cart = new ShoppingCart("TEST");

cart.AddItem(new Product("SKU"));

Assert.AreEqual(1, cart.TotalItems);

}

variations on a theme
Variations on a Theme

User Story

Structure

AAA

Context

Specification

sharing context
Sharing Context
  • Keeps our tests DRY
  • Reuse existing classes
context chaining
Context Chaining
  • Keeps our tests DRY
  • Can be fragile
  • Watch Depth of Inheritance
mspec
MSpec
  • Popular Context / Specification library
  • Love it or hate it
  • Less to type than rolling your own
  • May replace existing your existing unit test framework
  • Includes report generator
  • Get it here: http://link.pluralsight.com/39um

= () =>

storyq
StoryQ
  • Get started with BDD quickly
  • Too prescriptive for some
  • Fluent interface for ease-of-use
  • Compatible with MSTest / NUnit / XUnit
  • Get it here: http://link.pluralsight.com/3jaf
other projects of interest
Other Projects of Interest
  • StorEvil – Another good .NET BDD libraryhttp://link.pluralsight.com/4n4z
  • SpecFlow – Another good .NET BDD libraryhttp://link.pluralsight.com/3uwd
  • Cucumber – BDD for Ruby and IronRubyhttp://link.pluralsight.com/56j7
  • Gherkin – A DSL for BDDhttp://link.pluralsight.com/46nm
  • StoryTeller- .NET native alternative to Fitnessehttp://link.pluralsight.com/5vdn
summary
Summary
  • Better understand each other before getting started
  • Ideas of Functionality are Desirements
  • Desirements express well as User Stories
  • BDD helps turn Desirements into Requirements
  • There are many supporting tools to help

starr@pluralsight.com

Blog: ElegantCode.com

@elegantcoder

resources

Required Slide

Resources

Learning

  • Sessions On-Demand & Community
  • Microsoft Certification & Training Resources

www.microsoft.com/teched

www.microsoft.com/learning

  • Resources for IT Professionals
  • Resources for Developers
  • http://microsoft.com/technet
  • http://microsoft.com/msdn
slide19

Required Slide

Complete an evaluation on CommNet and enter to win!

slide20

Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st

http://northamerica.msteched.com/registration

You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

slide21

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.