SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
Behavior
Driven
Development

Manodnya Lele
Ben Maynard
About Litle & Co.

• Litle & Co. is a leading financial technology company
• One of the largest, private, non-bank proprietary
   processing platforms serving the Card-not-Present
   marketplace
• Specific expertise in Card-not-Present transactions,
   deep knowledge of Best Practices, Card Association
   Regulations, PCI and Data Security requirements
• Litle Vault is the 2011 Stevie Award Winner in New
   Product & Services (Web/IVR) category
Outline

•   What is BDD?
•   History
•   Why not TDD?
•   The Story
•   Tools: Compare and Contrast
•   Comments and Questions
What is BDD?




BDD can turn an idea for a requirement into
  implemented, tested, production-ready code simply
  and effectively, as long as the requirement is specific
  enough that everyone knows what’s going on.
                                     -Dan North
What is BDD?




BDD can turn an idea for a requirement into
  implemented, tested, production-ready code simply
  and effectively, as long as the requirement is specific
  enough that everyone knows what’s going on.
                                     -Dan North
What is BDD?




BDD can turn an idea for a requirement into
  implemented, tested, production-ready code simply
  and effectively, as long as the requirement is specific
  enough that everyone knows what’s going on.
                                     -Dan North
What is BDD?




BDD can turn an idea for a requirement into
  implemented, tested, production-ready code simply
  and effectively, as long as the requirement is specific
  enough that everyone knows what’s going on.
                                     -Dan North
History



1999
   Test First
   Development
                 2003
                    Behavior Driven
                    Development
History



1999
   Test First
   Development
                 2003
                    Behavior Driven
                    Development
    Kent Beck
History




Kent Beck   Dan North
Why not TDD?




BAs / Program Managers   Techies
Why not TDD?




BAs / Program Managers    Techies
• Requirements docs not
  technical enough
Why not TDD?




BAs / Program Managers    Techies
• Requirements docs not   • Test cases and unit tests
  technical enough           too technical
Why not TDD?
Why not TDD?




     BDD
Given… When… Then…
Why not TDD?



TDD


      BDD
Why not TDD?



TDD
Building the thing right


                   BDD
Why not TDD?



TDD
Building the thing right


                   BDD
                   Building the right thing
BDD:
The Story
BDD: The Story
• A way to describe the requirement such that everyone
           the business folks,
           the analyst,
           the developer,
           the tester,
           and others
   has a common understanding of the scope of the work.

• A description of a requirement and its business benefit, and a set of
  criteria by which we all agree that it is “done”.

• Remember:                              Given… When… Then…
BDD: The Story

• The title should describe an activity
     Describes actual behavior by a user of the system.

• The narrative should include a role, a feature and a benefit
     “As a [role] I want [feature] so that [benefit]“

• The scenario should be described in terms of givens, events
  and outcomes

                                     Given… When… Then…
BDD: The Story

Title
        Easier user experience with online site

Narrative
     As a(n) active, participating member of my company
     I want a better online website
     So that users can easily use and purchase on our website

 Scenario 1: Smooth Checkout Process             Scenario 2: Better Site Uptime
      Given our world class web sales app             Given that a potential buyer
        And items in my shopping cart                 When a user enters our URL into a browser
      When a user clicks “checkout”                   Then the site will be available over 99.97%
      Then the user will move through checkout              of the time
          with a maximum of two page clicks
        And maintain an https session with our site
BDD Tool Overview
Motivating Example

FizzBuzz

• Simple program that outputs a number and expects
  the player to guess which word applies:
   – Divisible by 3: “Fizz”
   – Divisible by 5: “Buzz”
   – Divisible by 3 and 5: “FizzBuzz”
jbehave
http://jbehave.org
How to write a BDD test in jbehave

• Write the story in a file with a <story_name>.story
  name
• Create the implementation in Java in a class named
  <StoryName>Steps.java
• Create an Runner, extending JUnitStory to link the
  story to the implementation
• Runner also can specify other details such as output
  formats
jbehave Story

• Story: Play fizz-buzz                      • Examples:
    As a math game player                       |value|display|
    I would like to play fizz-buzz              |1|1|
    So that I can learn how to calculate
                                                |2|2|
        multiples
                                                |3|fizz|
    Scenario: When to fizz                      |4|4|
       Given a fizz-buzz player                 |5|buzz|
       When I ask to fizz-buzz for 3            |6|fizz|
       Then I should get a fizz                 |7|7|
                                                |8|8|
    Scenario: When to fizz-buzz
                                                |9|fizz|
       Given a fizz-buzz player
                                                |10|buzz|
       When I ask to fizz-buzz for <value>
       Then I should get a <display>
                                                |15|fizz-buzz|
                                                |30|fizz-buzz|
jbehave Test Code

public class PlayFizzBuzzSteps            @Then("I should get a <display>")
{                                         @Alias("I should get a $display")
  private FizzBuzzer fb;                  public void isBuzz(@Named("display") final
  private String answer;                      String display)
                                          {
@Given("a fizz-buzz player")                assertThat(answer, is(display));
public void givenAFizzBuzzPlayer()        }
{ fb = new FizzBuzzer(3, 5);
}
@When("I ask to fizz-buzz for <value>")
@Alias("I ask to fizz-buzz for $value")
public void answer(@Named("value")
  final int value)
{ answer = fb.answer(value);
 }
jbehave Runner

public class PlayFizzBuzz extends JUnitStory {

    public PlayFizzBuzz()
    {
      addSteps(new InstanceStepsFactory(configuration(), new PlayFizzBuzzSteps())
       .createCandidateSteps());
    }
    @Override
    public Configuration configuration()
    {
      return super.configuration()
       .useStoryReporterBuilder(new StoryReporterBuilder().withFormats(Format.CONSOLE,
                                         Format.TXT,
                                         Format.HTML));
    }
}
easyb
http://easyb.org
FizzBuzz with easyb

narrative "while playing fizz-buzz", {
    as_a "fizz-buzz player"
    i_want "to automate my responses"
    so_that "i always win"
}
 scenario "fizzing", {
    given "a fizz-buzz player", {
      fb = new sf.projects.fizzbuzz.FizzBuzzer(3, 5)
    }
    when "3", {
      display = fb.answer(3);
    }
    then "should fizz", { display.shouldBe "fizz" }
}
Cucumber
http://cukes.info
Cucumber Feature

Feature: Play Fizz Buzz
  As a math game player
  I would like to play fizz-buzz
  So that I can learn how to calculate multiples

Scenario: When to fizz
  Given a fizz-buzz player
  When I ask to fizz-buzz for 3
  Then I should get a fizz
Cucumber Test Code

Given /a fizz-buzz player/ do |n|
  @fb = FizzerBuzzer.new
end

When /I ask to fizz-buzz for 3/ do |op|
 @result = @fb.answer op
end

Then /I should get a fizz/ do |result|
 @result.should == result.to_f
end
Compare and Contrast

Criteria            jbehave           easyb             Cucumber
Language written    Java              Groovy            Ruby
in
Languages           Any language on   Any language on   Ruby or (with
supported           the JVM           the JVM           Cuke4Duke) Java

Writing the story   Separate files    Single file       Separate files
and test



Running tests       Commandline, Ant, Commandline, Ant, Commandline or
                    Maven, IDEs like  Maven, IDEs like  (with Cuke4Duke)
                    Eclipse, JUnit    Eclipse, JUnit    Ant, Maven, IDEs
                                                        like Eclipse
Criteria            jbehave            easyb                Cucumber
Pending tests       Supported          Supported            Supported
feature
Running multiple    Supported          Supported            Supported
tests
Assertion feature   Can use Hamcrest   Uses ‘ensure’        Uses Ruby
                    matchers for       syntax, similar to   framework
                    assertion          assert
Installation        Easy               Easy                 Fair
Documentation       Good               Extremely good       No documentation
support                                                     but good
                                                            community
                                                            support
Year of inception   2003               2009                 2008
Author              Dan North          Andy Glover          Aslak Hellesøy
Summary

Given that you have heard this presentation
 And discovered that BDD is really fun
When you are thinking about testing strategies
Then you should give BDD a chance!

• Questions /Comments are welcome….

• Contacts
   – Ben Maynard: bmaynard@litle.com
   – Manodnya Lele: mlele@litle.com
Materials

Ready-made BDD project (Sualeh Fatehi)
   http://code.google.com/p/test-fizzbuzz/

Más contenido relacionado

Similar a Behavior Driven Development: An Overview

BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumberDaniel Kummer
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentNETUserGroupBern
 
Effective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven DevelopmentEffective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven DevelopmentAlexander Kress
 
BDD - Keep love alive
BDD - Keep love aliveBDD - Keep love alive
BDD - Keep love aliveRory Preddy
 
ITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentOrtus Solutions, Corp
 
German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...Bastian Seehaus
 
Is Your API Misbehaving (workshop)
Is Your API Misbehaving (workshop)Is Your API Misbehaving (workshop)
Is Your API Misbehaving (workshop)Keith Casey
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...marcin_pajdzik
 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentPankaj Nakhat
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Synerzip
 
Behavior-Driven-Development (BDD) for Conversational Applications
Behavior-Driven-Development (BDD) for Conversational ApplicationsBehavior-Driven-Development (BDD) for Conversational Applications
Behavior-Driven-Development (BDD) for Conversational ApplicationsFlorian Georg
 
Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Fabio Armani
 
TDD & BDD in F# at Progressive F# Tutorials 2011
TDD & BDD in F# at Progressive F# Tutorials 2011TDD & BDD in F# at Progressive F# Tutorials 2011
TDD & BDD in F# at Progressive F# Tutorials 2011Phillip Trelford
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia eventXebia India
 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDDKonstantin Kudryashov
 
Building Your App SDK with Swift
Building Your App SDK with SwiftBuilding Your App SDK with Swift
Building Your App SDK with SwiftJordan Yaker
 
Why BaaS is crucial to early stage startups
Why BaaS is crucial to early stage startupsWhy BaaS is crucial to early stage startups
Why BaaS is crucial to early stage startupsJane Chung
 

Similar a Behavior Driven Development: An Overview (20)

BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Effective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven DevelopmentEffective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven Development
 
BDD - Keep love alive
BDD - Keep love aliveBDD - Keep love alive
BDD - Keep love alive
 
ITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven Development
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...
 
Is Your API Misbehaving (workshop)
Is Your API Misbehaving (workshop)Is Your API Misbehaving (workshop)
Is Your API Misbehaving (workshop)
 
Automation in Drupal
Automation in DrupalAutomation in Drupal
Automation in Drupal
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...
 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven Development
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
 
BDD, Behat & Drupal
BDD, Behat & DrupalBDD, Behat & Drupal
BDD, Behat & Drupal
 
Behavior-Driven-Development (BDD) for Conversational Applications
Behavior-Driven-Development (BDD) for Conversational ApplicationsBehavior-Driven-Development (BDD) for Conversational Applications
Behavior-Driven-Development (BDD) for Conversational Applications
 
Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011
 
TDD & BDD in F# at Progressive F# Tutorials 2011
TDD & BDD in F# at Progressive F# Tutorials 2011TDD & BDD in F# at Progressive F# Tutorials 2011
TDD & BDD in F# at Progressive F# Tutorials 2011
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia event
 
Moving away from legacy code with BDD
Moving away from legacy code with BDDMoving away from legacy code with BDD
Moving away from legacy code with BDD
 
Building Your App SDK with Swift
Building Your App SDK with SwiftBuilding Your App SDK with Swift
Building Your App SDK with Swift
 
Why BaaS is crucial to early stage startups
Why BaaS is crucial to early stage startupsWhy BaaS is crucial to early stage startups
Why BaaS is crucial to early stage startups
 

Último

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Behavior Driven Development: An Overview

  • 2. About Litle & Co. • Litle & Co. is a leading financial technology company • One of the largest, private, non-bank proprietary processing platforms serving the Card-not-Present marketplace • Specific expertise in Card-not-Present transactions, deep knowledge of Best Practices, Card Association Regulations, PCI and Data Security requirements • Litle Vault is the 2011 Stevie Award Winner in New Product & Services (Web/IVR) category
  • 3. Outline • What is BDD? • History • Why not TDD? • The Story • Tools: Compare and Contrast • Comments and Questions
  • 4. What is BDD? BDD can turn an idea for a requirement into implemented, tested, production-ready code simply and effectively, as long as the requirement is specific enough that everyone knows what’s going on. -Dan North
  • 5. What is BDD? BDD can turn an idea for a requirement into implemented, tested, production-ready code simply and effectively, as long as the requirement is specific enough that everyone knows what’s going on. -Dan North
  • 6. What is BDD? BDD can turn an idea for a requirement into implemented, tested, production-ready code simply and effectively, as long as the requirement is specific enough that everyone knows what’s going on. -Dan North
  • 7. What is BDD? BDD can turn an idea for a requirement into implemented, tested, production-ready code simply and effectively, as long as the requirement is specific enough that everyone knows what’s going on. -Dan North
  • 8. History 1999 Test First Development 2003 Behavior Driven Development
  • 9. History 1999 Test First Development 2003 Behavior Driven Development Kent Beck
  • 10. History Kent Beck Dan North
  • 11. Why not TDD? BAs / Program Managers Techies
  • 12. Why not TDD? BAs / Program Managers Techies • Requirements docs not technical enough
  • 13. Why not TDD? BAs / Program Managers Techies • Requirements docs not • Test cases and unit tests technical enough too technical
  • 15. Why not TDD? BDD Given… When… Then…
  • 17. Why not TDD? TDD Building the thing right BDD
  • 18. Why not TDD? TDD Building the thing right BDD Building the right thing
  • 20. BDD: The Story • A way to describe the requirement such that everyone the business folks, the analyst, the developer, the tester, and others has a common understanding of the scope of the work. • A description of a requirement and its business benefit, and a set of criteria by which we all agree that it is “done”. • Remember: Given… When… Then…
  • 21. BDD: The Story • The title should describe an activity Describes actual behavior by a user of the system. • The narrative should include a role, a feature and a benefit “As a [role] I want [feature] so that [benefit]“ • The scenario should be described in terms of givens, events and outcomes Given… When… Then…
  • 22. BDD: The Story Title Easier user experience with online site Narrative As a(n) active, participating member of my company I want a better online website So that users can easily use and purchase on our website Scenario 1: Smooth Checkout Process Scenario 2: Better Site Uptime Given our world class web sales app Given that a potential buyer And items in my shopping cart When a user enters our URL into a browser When a user clicks “checkout” Then the site will be available over 99.97% Then the user will move through checkout of the time with a maximum of two page clicks And maintain an https session with our site
  • 24. Motivating Example FizzBuzz • Simple program that outputs a number and expects the player to guess which word applies: – Divisible by 3: “Fizz” – Divisible by 5: “Buzz” – Divisible by 3 and 5: “FizzBuzz”
  • 26. How to write a BDD test in jbehave • Write the story in a file with a <story_name>.story name • Create the implementation in Java in a class named <StoryName>Steps.java • Create an Runner, extending JUnitStory to link the story to the implementation • Runner also can specify other details such as output formats
  • 27. jbehave Story • Story: Play fizz-buzz • Examples: As a math game player |value|display| I would like to play fizz-buzz |1|1| So that I can learn how to calculate |2|2| multiples |3|fizz| Scenario: When to fizz |4|4| Given a fizz-buzz player |5|buzz| When I ask to fizz-buzz for 3 |6|fizz| Then I should get a fizz |7|7| |8|8| Scenario: When to fizz-buzz |9|fizz| Given a fizz-buzz player |10|buzz| When I ask to fizz-buzz for <value> Then I should get a <display> |15|fizz-buzz| |30|fizz-buzz|
  • 28. jbehave Test Code public class PlayFizzBuzzSteps @Then("I should get a <display>") { @Alias("I should get a $display") private FizzBuzzer fb; public void isBuzz(@Named("display") final private String answer; String display) { @Given("a fizz-buzz player") assertThat(answer, is(display)); public void givenAFizzBuzzPlayer() } { fb = new FizzBuzzer(3, 5); } @When("I ask to fizz-buzz for <value>") @Alias("I ask to fizz-buzz for $value") public void answer(@Named("value") final int value) { answer = fb.answer(value); }
  • 29. jbehave Runner public class PlayFizzBuzz extends JUnitStory { public PlayFizzBuzz() { addSteps(new InstanceStepsFactory(configuration(), new PlayFizzBuzzSteps()) .createCandidateSteps()); } @Override public Configuration configuration() { return super.configuration() .useStoryReporterBuilder(new StoryReporterBuilder().withFormats(Format.CONSOLE, Format.TXT, Format.HTML)); } }
  • 31. FizzBuzz with easyb narrative "while playing fizz-buzz", { as_a "fizz-buzz player" i_want "to automate my responses" so_that "i always win" } scenario "fizzing", { given "a fizz-buzz player", { fb = new sf.projects.fizzbuzz.FizzBuzzer(3, 5) } when "3", { display = fb.answer(3); } then "should fizz", { display.shouldBe "fizz" } }
  • 33. Cucumber Feature Feature: Play Fizz Buzz As a math game player I would like to play fizz-buzz So that I can learn how to calculate multiples Scenario: When to fizz Given a fizz-buzz player When I ask to fizz-buzz for 3 Then I should get a fizz
  • 34. Cucumber Test Code Given /a fizz-buzz player/ do |n| @fb = FizzerBuzzer.new end When /I ask to fizz-buzz for 3/ do |op| @result = @fb.answer op end Then /I should get a fizz/ do |result| @result.should == result.to_f end
  • 35. Compare and Contrast Criteria jbehave easyb Cucumber Language written Java Groovy Ruby in Languages Any language on Any language on Ruby or (with supported the JVM the JVM Cuke4Duke) Java Writing the story Separate files Single file Separate files and test Running tests Commandline, Ant, Commandline, Ant, Commandline or Maven, IDEs like Maven, IDEs like (with Cuke4Duke) Eclipse, JUnit Eclipse, JUnit Ant, Maven, IDEs like Eclipse
  • 36. Criteria jbehave easyb Cucumber Pending tests Supported Supported Supported feature Running multiple Supported Supported Supported tests Assertion feature Can use Hamcrest Uses ‘ensure’ Uses Ruby matchers for syntax, similar to framework assertion assert Installation Easy Easy Fair Documentation Good Extremely good No documentation support but good community support Year of inception 2003 2009 2008 Author Dan North Andy Glover Aslak Hellesøy
  • 37. Summary Given that you have heard this presentation And discovered that BDD is really fun When you are thinking about testing strategies Then you should give BDD a chance! • Questions /Comments are welcome…. • Contacts – Ben Maynard: bmaynard@litle.com – Manodnya Lele: mlele@litle.com
  • 38. Materials Ready-made BDD project (Sualeh Fatehi) http://code.google.com/p/test-fizzbuzz/