SlideShare a Scribd company logo
1 of 108
Specification By
   Example
   Declan Whelan
    @dwhelan
What’s the Problem?
Waterfall




Source: http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf
Waterfall



                              X
Source: http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf
Cost Of Change


 Cost%
  Of%
Change%




                 Time%
Agile Specification
                  Agile&Approach&
           Itera/on&1&          Itera/on&2&           Itera/on&3&          Itera/on&4&
           Requirements&        Requirements&         Requirements&        Requirements&

          Analysis&&&Design&   Analysis&&&Design&    Analysis&&&Design&   Analysis&&&Design&
 Cost%
  of%           Code&                Code&                 Code&                Code&
Change%
                Test&                Test&                 Test&                Test&

                                                                               Deploy&




                                             Time%
Traditional Flow
Traditional Flow



Specification
Traditional Flow

               Build


Specification
Traditional Flow

                 Build


Specification


               Tests Cases
Traditional Flow

                 Build


Specification                 Test

               Tests Cases
Traditional Flow

                 Build


Specification                 Test
                                    Deploy

               Tests Cases
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
We Found a Bug!
                                                How did QA miss this?



  That was obvious! I shouldn't                                             Developers don't test before
    have to spell out every                                                  they throw it over the wall!
            detail!


                                            Exec


                                                                          Tester
Product
Manager


                                                                                     We did what was in
                                                                                      functional spec!
                 Business requirements
                     weren't clear!

                                                  BA missed it in the
                                                technical requirements!
                                                                               Dev


            BA


                                         Architect
Accidental Adversaries
                               +
                                       Testing




                                                 +
                                                          New Bugs

                                                                                -      +
              -                                                             +
Testing           Additional                                                    Development
                                                         Software Fix
Success             Tests                                                         Success

          +                                                             -
+     -

                  New Build
                                   +



                                   Development

                                                     +
Functional Silos




Source: http://www.danpontefract.com/images/silo.jpg
Functional Silos



                    X
Source: http://www.danpontefract.com/images/silo.jpg
Build it Right




                                            Build the Right Thing




Specification By Example
Gojko Adzic, 2011 page 4
Build it Right




                                            Build the Right Thing



    Useless Crap
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure




                                            Build the Right Thing



    Useless Crap
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure




                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure                             Business Success




                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure                             Business Success


                                               Specification By
                                                  Example

                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
What are Specifications
    By Example?
What are Specifications
    By Example?
• Thin slices of system behaviour
• that deliver business value
• described as concrete examples
• that are potentially automatable
• without translation
• to create executable specifications
• captured in live documentation.
Agile Testing Quadrants
Specification By Example
Specification By Example
        Business Goal
Specification By Example
        Business Goal
                Derive the scope
           Scope
Specification By Example
        Business Goal
                Derive the scope
           Scope
                Specify collaboratively
        Key Examples
Specification By Example
           Business Goal
                   Derive the scope
               Scope
                   Specify collaboratively
           Key Examples
                   Refine the specification
     Specification With Examples
Specification By Example
           Business Goal
                   Derive the scope
               Scope
                   Specify collaboratively
           Key Examples
                   Refine the specification
     Specification With Examples
                   Automate literally
      Executable Specification
Specification By Example
           Business Goal
                   Derive the scope
               Scope
                   Specify collaboratively
           Key Examples
                   Refine the specification
     Specification With Examples
                   Automate literally
      Executable Specification
                   Validate frequently
       Living Documentation
Specification By Example
                             Business Goal
                                     Derive the scope
                                 Scope




                                                               Shared Understanding
 Ubiquitous Language



                                     Specify collaboratively
                             Key Examples
                                     Refine the specification
                       Specification With Examples
                                     Automate literally
                        Executable Specification
                                     Validate frequently
                         Living Documentation
Source: https://docs.google.com/drawings/d/1cbfKq-KazcbMVCnRfih6zMSDBdtf90KviV7l2oxGyWM/edit
                                                                                              Specification By Example
                                                                                                                           Business Goal
                                                                                                                                   Derive the scope
                                                                                                                               Scope




                                                                                                                                                             Shared Understanding
                                                                                               Ubiquitous Language



                                                                                                                                   Specify collaboratively
                                                                                                                           Key Examples
                                                                                                                                   Refine the specification
                                                                                                                     Specification With Examples
                                                                                                                                   Automate literally
                                                                                                                      Executable Specification
                                                                                                                                   Validate frequently
                                                                                                                       Living Documentation
Derive the Scope: Story Mapping




Source: http://availagility.co.uk/wp-content/uploads/2008/10/user-story-mapping.png
Derive the Scope: User Stories
Derive the Scope: User Stories

            As a _______
         I want to _______
          So that _______
Derive the Scope: User Stories

               As a _______
            I want to _______
             So that _______


                As a student
    I want to purchase used books online
          So that I can save money
Specify Collaboratively: Workshops
Specify Collaboratively: Workshops
Specify Collaboratively: Workshops


 • Hold regular product backlog workshops
Specify Collaboratively: Workshops


 • Hold regular product backlog workshops
 • Full team workshops - when starting
Specify Collaboratively: Workshops


 • Hold regular product backlog workshops
 • Full team workshops - when starting
 • Three amigo workshops:
  • One developer
  • One tester
  • One analyst
Specify Collaboratively: Key Examples
Specify Collaboratively: Key Examples

             Given _______
             When _______
             Then _______
Specify Collaboratively: Key Examples

                     Given _______
                     When _______
                     Then _______


Given “War and Peace” is available as a used book for $2.99
        When Susan selects book“War and Peace”
          Then “Buy used for $2.99” is displayed
Refining the Specification
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic


• Be precise and make sure spec is testable
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic


• Be precise and make sure spec is testable
• Avoid “scripts” and “flows”
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic


• Be precise and make sure spec is testable
• Avoid “scripts” and “flows”
• Focus on business functionality not design
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic


• Be precise and make sure spec is testable
• Avoid “scripts” and “flows”
• Focus on business functionality not design
• Avoid UI details
Refining the Specification
“Specifications with examples are acceptance tests”
                                     Gojko Adzic


• Be precise and make sure spec is testable
• Avoid “scripts” and “flows”
• Focus on business functionality not design
• Avoid UI details
• Avoid covering every possible combination
Refining the Specification: An Example
   Free Delivery
   Free delivery is offered to VIP customers once they purchase a certain number of books.
   Free delivery is not offered to regular customers or VIP customers buying anything other than
   books.

      Customer Type                      Cart Contents                        Delivery
                VIP                            5 books                    Free, Standard
                VIP                            4 books                        Standard
             Regular                          10 books                        Standard
                VIP                        5 dishwashers                      Standard
                VIP                  5 books, 1 dishwasher                    Standard

Source: Specification by Example: How successful teams deliver the right software, Gojko Adzic, pg. 116
Automating Examples
Automating Examples

• Start small
Automating Examples

• Start small
• Select important examples for automation
Automating Examples

• Start small
• Select important examples for automation
• Plan up-front to automate
Automating Examples

• Start small
• Select important examples for automation
• Plan up-front to automate
• Be prepared to go slower at the start
Automating Examples

• Start small
• Select important examples for automation
• Plan up-front to automate
• Be prepared to go slower at the start
• Treat automation code as a first class citizen
Automating Examples

• Start small
• Select important examples for automation
• Plan up-front to automate
• Be prepared to go slower at the start
• Treat automation code as a first class citizen
• Avoid record and playback
Automating Examples

• Start small
• Select important examples for automation
• Plan up-front to automate
• Be prepared to go slower at the start
• Treat automation code as a first class citizen
• Avoid record and playback
• Avoid using pre-populated data
Minimize Tests Through the UI
Automation Tools

FitNesse    Cucumber    Concordian

Green
             JBehave      Twist
Pepper
              Robot
Text Test                SpecFlow
            Framework
Validate Frequently
Validate Frequently
• Start with a Continuous Integration system
Validate Frequently
• Start with a Continuous Integration system
• Set up a Continuous Deployment system
Validate Frequently
• Start with a Continuous Integration system
• Set up a Continuous Deployment system
• Specify and test business logic separately
  from end-to-end flows
Validate Frequently
• Start with a Continuous Integration system
• Set up a Continuous Deployment system
• Specify and test business logic separately
  from end-to-end flows
• Organize tests along functional lines
Validate Frequently
• Start with a Continuous Integration system
• Set up a Continuous Deployment system
• Specify and test business logic separately
  from end-to-end flows
• Organize tests along functional lines
• Run all test nightly
Validate Frequently
• Start with a Continuous Integration system
• Set up a Continuous Deployment system
• Specify and test business logic separately
  from end-to-end flows
• Organize tests along functional lines
• Run all test nightly
• Consider an iteration “test pack”
Living Documentation
• Keep specifications short
• Evolve a specification language and leverage
  in with “common fixtures”
• Make documentation accessible - consider
  a wiki
• Organize the documentation
• Put specifications under version control
A Worked Example
Executable Specification
Cucumber Organization
                  fixtures are common




   Features     Step



               System
Cucumber Organization
                  fixtures are common




         ad
        Lo


   Features     Step



               System
Cucumber Organization
                     fixtures are common




              M
         ad




              at
        Lo




                ch
   Features       Step



               System
Cucumber Organization
                            fixtures are common




              M
         ad




              at
        Lo




                ch
   Features       Step



                     Call
               System
Feature File
  Feature: Turn cucumber into beer
   As a cucumber presenter
   I want beer after my presentation
   So I can enjoy the rest of DemoCampGuelph

   Scenario: Brydon buys Declan beer
    Given Brydon hosts DemoCampGuelph
    When Declan demos Cucumber
    Then Brydon should buy Declan 1 beer

   Scenario: Ali buys Declan beer
    Given Ali hosts DemoCampGuelph
    When Declan demos Cucumber
    Then Ali should buy Declan 1 beer
Step Definitions
Given /^(.+) hosts/ do |host|
 @event = Event.new(host)
end

When /^(.+) demos/ do |presenter|
 @event.add(presenter)
end

Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker,
qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
 perk.quantity.should == quantity.to_i; perk.item.should
== item
end
System Under Test
 class Event
  attr_reader :perks

  def initialize(host) @host = host; @perks = [] end

  def add(presenter)
   @perks.push Perk.new(@host, presenter, 1, "beer")
  end
 end

 class Perk
  attr_reader :buyer, :receiver, :quantity, :item

  def initialize(buyer, receiver, quantity, item)
   @buyer = buyer; @receiver = receiver
   @quantity = quantity; @item = item
  end
 end
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Given /^(.+) hosts/ do | When /^(.+) demos/ do |
host|                     presenter|
 @event =                   @event.add(presenter)
Event.new(host)           end
End
Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer,
drinker, qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Given /^(.+) hosts/ do |
host|
 @event =
Event.new(host)
End
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Given /^(.+) hosts/ do |
host|                      “Brydon”
 @event =
Event.new(host)
End
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Given /^(.+) hosts/ do | When /^(.+) demos/ do |
host|                     presenter|
 @event =                   @event.add(presenter)
Event.new(host)           end
End
Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer,
drinker, qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
                  When /^(.+) demos/ do |
                  presenter|
                   @event.add(presenter)
                  end
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
                   When /^(.+) demos/ do |
                   presenter|
                    @event.add(presenter)
                   end
        “Declan”
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer
Given /^(.+) hosts/ do | When /^(.+) demos/ do |
host|                     presenter|
 @event =                   @event.add(presenter)
Event.new(host)           end
End
Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer,
drinker, qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer




Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer,
drinker, qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
Execution
Scenario: Brydon buys Declan beer
 Given Brydon hosts DemoCampGuelph
 When Declan demos Cucumber
 Then Brydon should buy Declan 1 beer




Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer,
drinker, qty, item|
 perk = @event.perks[0];
 perk.buyer.should == buyer; perk.receiver.should ==
drinker
Source: https://docs.google.com/drawings/d/1cbfKq-KazcbMVCnRfih6zMSDBdtf90KviV7l2oxGyWM/edit
                                                                                              Specification By Example
                                                                                                                           Business Goal
                                                                                                                                   Derive the scope
                                                                                                                               Scope




                                                                                                                                                             Shared Understanding
                                                                                               Ubiquitous Language



                                                                                                                                   Specify collaboratively
                                                                                                                           Key Examples
                                                                                                                                   Refine the specification
                                                                                                                     Specification With Examples
                                                                                                                                   Automate literally
                                                                                                                      Executable Specification
                                                                                                                                   Validate frequently
                                                                                                                       Living Documentation
Build it Right




                                            Build the Right Thing




Specification By Example
Gojko Adzic, 2011 page 4
Build it Right




                                            Build the Right Thing



    Useless Crap
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure




                                            Build the Right Thing



    Useless Crap
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure




                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure                             Business Success




                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
Build it Right
  Business Failure                             Business Success


                                               Specification By
                                                  Example

                                            Build the Right Thing



    Useless Crap                      Maintenance Nightmare
Specification By Example
Gojko Adzic, 2011 page 4
Reading
Specification By Example
Gojko Adzic

The RSpec Book: Behaviour Driven Development with
RSpec, Cucumber and Friends
David Cheliminksy et al

Agile Testing: A Practical Guide for Testers and Agile Teams
Lisa Crispin, Janet Gregory
Diagram Credits

   Lisa Crispin and Janet Gregory
   Agile Testing: A Practical Guide for Testers
   and Agile Teams
   Addison-Wesley Professional; January 9, 2009.




   Mike Cohn
   Succeeding with Agile: Software Development
   Using Scrum
   Addison-Wesley Professional; November 5, 2009.

More Related Content

What's hot

BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
John Ferguson Smart Limited
 

What's hot (20)

Exploratory Testing Explained and Experienced
Exploratory Testing Explained and ExperiencedExploratory Testing Explained and Experienced
Exploratory Testing Explained and Experienced
 
Introduction to Agile Testing
Introduction to Agile TestingIntroduction to Agile Testing
Introduction to Agile Testing
 
An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Agile Testing and Test Automation
Agile Testing and Test AutomationAgile Testing and Test Automation
Agile Testing and Test Automation
 
Agile testing - Testing From Day 1
Agile testing - Testing From Day 1Agile testing - Testing From Day 1
Agile testing - Testing From Day 1
 
2019 Top Lessons Learned Since the Phoenix Project Was Released
2019 Top Lessons Learned Since the Phoenix Project Was Released2019 Top Lessons Learned Since the Phoenix Project Was Released
2019 Top Lessons Learned Since the Phoenix Project Was Released
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile Tester
 
Agile Software Development Overview
Agile Software Development OverviewAgile Software Development Overview
Agile Software Development Overview
 
The 10 Steps to Becoming a Great Agile Coach
The 10 Steps to Becoming a Great Agile CoachThe 10 Steps to Becoming a Great Agile Coach
The 10 Steps to Becoming a Great Agile Coach
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Introduction to Agile software testing
Introduction to Agile software testingIntroduction to Agile software testing
Introduction to Agile software testing
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Agile and user story workshop Peter Saddington
Agile and user story workshop   Peter SaddingtonAgile and user story workshop   Peter Saddington
Agile and user story workshop Peter Saddington
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
ScrumBan : Best of Both Worlds. A Fertile Hybrid
ScrumBan : Best of Both Worlds. A Fertile HybridScrumBan : Best of Both Worlds. A Fertile Hybrid
ScrumBan : Best of Both Worlds. A Fertile Hybrid
 
Agile 101
Agile 101Agile 101
Agile 101
 
Specification-By-Example with Gherkin
Specification-By-Example with GherkinSpecification-By-Example with Gherkin
Specification-By-Example with Gherkin
 
Agile presentation
Agile presentationAgile presentation
Agile presentation
 

Viewers also liked

Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013
gojkoadzic
 
How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014
gojkoadzic
 

Viewers also liked (13)

Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013
 
Time to Bet on the Cloud?
Time to Bet on the Cloud?Time to Bet on the Cloud?
Time to Bet on the Cloud?
 
5 key challenges
5 key challenges5 key challenges
5 key challenges
 
Serverless Code Camp Barcelona
Serverless Code Camp BarcelonaServerless Code Camp Barcelona
Serverless Code Camp Barcelona
 
Death to the testing phase
Death to the testing phaseDeath to the testing phase
Death to the testing phase
 
Effective specifications for agile teams
Effective specifications for agile teamsEffective specifications for agile teams
Effective specifications for agile teams
 
Challenging Requirements/Oredev
Challenging Requirements/OredevChallenging Requirements/Oredev
Challenging Requirements/Oredev
 
Test Automation Without the Headache: Agile Tour Vienna 2015
Test Automation Without the Headache: Agile Tour Vienna 2015 Test Automation Without the Headache: Agile Tour Vienna 2015
Test Automation Without the Headache: Agile Tour Vienna 2015
 
How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014
 
Serverless JavaScript
Serverless JavaScriptServerless JavaScript
Serverless JavaScript
 
From Grid to Cloud
From Grid to CloudFrom Grid to Cloud
From Grid to Cloud
 
Sabotage product
Sabotage productSabotage product
Sabotage product
 
Agile Testers: Becoming a key asset for your team
Agile Testers: Becoming a key asset for your teamAgile Testers: Becoming a key asset for your team
Agile Testers: Becoming a key asset for your team
 

Similar to Specification by Example

Agile Software Design
Agile Software DesignAgile Software Design
Agile Software Design
eduardomg23
 
1 qm keynote-kamala_p
1 qm keynote-kamala_p1 qm keynote-kamala_p
1 qm keynote-kamala_p
IBM
 
Envisioning improving productivity and qaulity through better backlogs agi...
Envisioning   improving productivity and qaulity through better backlogs  agi...Envisioning   improving productivity and qaulity through better backlogs  agi...
Envisioning improving productivity and qaulity through better backlogs agi...
Tatlock
 
P&msp2010 09 integration-&-testing
P&msp2010 09 integration-&-testingP&msp2010 09 integration-&-testing
P&msp2010 09 integration-&-testing
Emanuele Della Valle
 
Ravit Danino HP - Roles and Collaboration in Agile
Ravit Danino HP - Roles and Collaboration in AgileRavit Danino HP - Roles and Collaboration in Agile
Ravit Danino HP - Roles and Collaboration in Agile
AgileSparks
 
Seeing what matters using the right vision to manage transition - Alan Shalloway
Seeing what matters using the right vision to manage transition - Alan ShallowaySeeing what matters using the right vision to manage transition - Alan Shalloway
Seeing what matters using the right vision to manage transition - Alan Shalloway
AGILEMinds
 

Similar to Specification by Example (20)

Introduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsIntroduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ students
 
Java Optimization For Faster Code & Better Results | J Optimizer
Java Optimization For Faster Code & Better Results | J OptimizerJava Optimization For Faster Code & Better Results | J Optimizer
Java Optimization For Faster Code & Better Results | J Optimizer
 
Requirements & scope
Requirements & scopeRequirements & scope
Requirements & scope
 
Continuous Delivery Overview
Continuous Delivery OverviewContinuous Delivery Overview
Continuous Delivery Overview
 
Manual testing1
Manual testing1Manual testing1
Manual testing1
 
An Introduction to Software Performance Engineering
An Introduction to Software Performance EngineeringAn Introduction to Software Performance Engineering
An Introduction to Software Performance Engineering
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsman
 
Agile Software Design
Agile Software DesignAgile Software Design
Agile Software Design
 
1 qm keynote-kamala_p
1 qm keynote-kamala_p1 qm keynote-kamala_p
1 qm keynote-kamala_p
 
QM Keynote - Kamala P
QM Keynote - Kamala PQM Keynote - Kamala P
QM Keynote - Kamala P
 
Software Testing Life Cycle
Software Testing Life CycleSoftware Testing Life Cycle
Software Testing Life Cycle
 
Session #1: Development Practices And The Microsoft Approach
Session #1: Development Practices And The Microsoft ApproachSession #1: Development Practices And The Microsoft Approach
Session #1: Development Practices And The Microsoft Approach
 
Envisioning improving productivity and qaulity through better backlogs agi...
Envisioning   improving productivity and qaulity through better backlogs  agi...Envisioning   improving productivity and qaulity through better backlogs  agi...
Envisioning improving productivity and qaulity through better backlogs agi...
 
P&msp2010 09 integration-&-testing
P&msp2010 09 integration-&-testingP&msp2010 09 integration-&-testing
P&msp2010 09 integration-&-testing
 
How to Performing DevBox.pptx
How to Performing DevBox.pptxHow to Performing DevBox.pptx
How to Performing DevBox.pptx
 
Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?
 
Ravit Danino HP - Roles and Collaboration in Agile
Ravit Danino HP - Roles and Collaboration in AgileRavit Danino HP - Roles and Collaboration in Agile
Ravit Danino HP - Roles and Collaboration in Agile
 
Seeing what matters using the right vision to manage transition - Alan Shalloway
Seeing what matters using the right vision to manage transition - Alan ShallowaySeeing what matters using the right vision to manage transition - Alan Shalloway
Seeing what matters using the right vision to manage transition - Alan Shalloway
 
DevOps - Its just Agile done right
DevOps - Its just Agile done rightDevOps - Its just Agile done right
DevOps - Its just Agile done right
 
Geneo Software Overview Mar 2012 Suggested Slides Copy
Geneo Software Overview   Mar 2012 Suggested Slides CopyGeneo Software Overview   Mar 2012 Suggested Slides Copy
Geneo Software Overview Mar 2012 Suggested Slides Copy
 

More from Declan Whelan

More from Declan Whelan (17)

Technical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failingTechnical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failing
 
From Technical Debt to Technical Health
From Technical Debt to Technical HealthFrom Technical Debt to Technical Health
From Technical Debt to Technical Health
 
effective agile adoption
effective agile adoptioneffective agile adoption
effective agile adoption
 
Big Balls of Mud
Big Balls of MudBig Balls of Mud
Big Balls of Mud
 
Navigating Organizational Change
Navigating Organizational ChangeNavigating Organizational Change
Navigating Organizational Change
 
Simple Design
Simple DesignSimple Design
Simple Design
 
Domain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDomain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with Rails
 
Win Win Conversations
Win Win ConversationsWin Win Conversations
Win Win Conversations
 
Agile 2012 Simple Design Applied
Agile 2012 Simple Design AppliedAgile 2012 Simple Design Applied
Agile 2012 Simple Design Applied
 
Releasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversationsReleasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversations
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010
 
Agile learning agile 2010
Agile learning agile 2010Agile learning agile 2010
Agile learning agile 2010
 
Agile Learning (60 minute version)
Agile Learning (60 minute version)Agile Learning (60 minute version)
Agile Learning (60 minute version)
 
Cuke2Beer
Cuke2BeerCuke2Beer
Cuke2Beer
 
Agile Learning from Agile 2009
Agile Learning from Agile 2009Agile Learning from Agile 2009
Agile Learning from Agile 2009
 
Agile, Tdd And .Net
Agile, Tdd And .NetAgile, Tdd And .Net
Agile, Tdd And .Net
 

Recently uploaded

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
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

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
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines 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...
 
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
 
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
 
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?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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...
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Specification by Example

  • 1. Specification By Example Declan Whelan @dwhelan
  • 4. Waterfall X Source: http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf
  • 5. Cost Of Change Cost% Of% Change% Time%
  • 6. Agile Specification Agile&Approach& Itera/on&1& Itera/on&2& Itera/on&3& Itera/on&4& Requirements& Requirements& Requirements& Requirements& Analysis&&&Design& Analysis&&&Design& Analysis&&&Design& Analysis&&&Design& Cost% of% Code& Code& Code& Code& Change% Test& Test& Test& Test& Deploy& Time%
  • 9. Traditional Flow Build Specification
  • 10. Traditional Flow Build Specification Tests Cases
  • 11. Traditional Flow Build Specification Test Tests Cases
  • 12. Traditional Flow Build Specification Test Deploy Tests Cases
  • 13. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 14. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 15. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 16. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 17. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 18. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 19. We Found a Bug! How did QA miss this? That was obvious! I shouldn't Developers don't test before have to spell out every they throw it over the wall! detail! Exec Tester Product Manager We did what was in functional spec! Business requirements weren't clear! BA missed it in the technical requirements! Dev BA Architect
  • 20. Accidental Adversaries + Testing + New Bugs - + - + Testing Additional Development Software Fix Success Tests Success + - + - New Build + Development +
  • 22. Functional Silos X Source: http://www.danpontefract.com/images/silo.jpg
  • 23. Build it Right Build the Right Thing Specification By Example Gojko Adzic, 2011 page 4
  • 24. Build it Right Build the Right Thing Useless Crap Specification By Example Gojko Adzic, 2011 page 4
  • 25. Build it Right Business Failure Build the Right Thing Useless Crap Specification By Example Gojko Adzic, 2011 page 4
  • 26. Build it Right Business Failure Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 27. Build it Right Business Failure Business Success Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 28. Build it Right Business Failure Business Success Specification By Example Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 30. What are Specifications By Example? • Thin slices of system behaviour • that deliver business value • described as concrete examples • that are potentially automatable • without translation • to create executable specifications • captured in live documentation.
  • 33. Specification By Example Business Goal
  • 34. Specification By Example Business Goal Derive the scope Scope
  • 35. Specification By Example Business Goal Derive the scope Scope Specify collaboratively Key Examples
  • 36. Specification By Example Business Goal Derive the scope Scope Specify collaboratively Key Examples Refine the specification Specification With Examples
  • 37. Specification By Example Business Goal Derive the scope Scope Specify collaboratively Key Examples Refine the specification Specification With Examples Automate literally Executable Specification
  • 38. Specification By Example Business Goal Derive the scope Scope Specify collaboratively Key Examples Refine the specification Specification With Examples Automate literally Executable Specification Validate frequently Living Documentation
  • 39. Specification By Example Business Goal Derive the scope Scope Shared Understanding Ubiquitous Language Specify collaboratively Key Examples Refine the specification Specification With Examples Automate literally Executable Specification Validate frequently Living Documentation
  • 40. Source: https://docs.google.com/drawings/d/1cbfKq-KazcbMVCnRfih6zMSDBdtf90KviV7l2oxGyWM/edit Specification By Example Business Goal Derive the scope Scope Shared Understanding Ubiquitous Language Specify collaboratively Key Examples Refine the specification Specification With Examples Automate literally Executable Specification Validate frequently Living Documentation
  • 41. Derive the Scope: Story Mapping Source: http://availagility.co.uk/wp-content/uploads/2008/10/user-story-mapping.png
  • 42. Derive the Scope: User Stories
  • 43. Derive the Scope: User Stories As a _______ I want to _______ So that _______
  • 44. Derive the Scope: User Stories As a _______ I want to _______ So that _______ As a student I want to purchase used books online So that I can save money
  • 47. Specify Collaboratively: Workshops • Hold regular product backlog workshops
  • 48. Specify Collaboratively: Workshops • Hold regular product backlog workshops • Full team workshops - when starting
  • 49. Specify Collaboratively: Workshops • Hold regular product backlog workshops • Full team workshops - when starting • Three amigo workshops: • One developer • One tester • One analyst
  • 51. Specify Collaboratively: Key Examples Given _______ When _______ Then _______
  • 52. Specify Collaboratively: Key Examples Given _______ When _______ Then _______ Given “War and Peace” is available as a used book for $2.99 When Susan selects book“War and Peace” Then “Buy used for $2.99” is displayed
  • 54. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic
  • 55. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic • Be precise and make sure spec is testable
  • 56. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic • Be precise and make sure spec is testable • Avoid “scripts” and “flows”
  • 57. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic • Be precise and make sure spec is testable • Avoid “scripts” and “flows” • Focus on business functionality not design
  • 58. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic • Be precise and make sure spec is testable • Avoid “scripts” and “flows” • Focus on business functionality not design • Avoid UI details
  • 59. Refining the Specification “Specifications with examples are acceptance tests” Gojko Adzic • Be precise and make sure spec is testable • Avoid “scripts” and “flows” • Focus on business functionality not design • Avoid UI details • Avoid covering every possible combination
  • 60. Refining the Specification: An Example Free Delivery Free delivery is offered to VIP customers once they purchase a certain number of books. Free delivery is not offered to regular customers or VIP customers buying anything other than books. Customer Type Cart Contents Delivery VIP 5 books Free, Standard VIP 4 books Standard Regular 10 books Standard VIP 5 dishwashers Standard VIP 5 books, 1 dishwasher Standard Source: Specification by Example: How successful teams deliver the right software, Gojko Adzic, pg. 116
  • 63. Automating Examples • Start small • Select important examples for automation
  • 64. Automating Examples • Start small • Select important examples for automation • Plan up-front to automate
  • 65. Automating Examples • Start small • Select important examples for automation • Plan up-front to automate • Be prepared to go slower at the start
  • 66. Automating Examples • Start small • Select important examples for automation • Plan up-front to automate • Be prepared to go slower at the start • Treat automation code as a first class citizen
  • 67. Automating Examples • Start small • Select important examples for automation • Plan up-front to automate • Be prepared to go slower at the start • Treat automation code as a first class citizen • Avoid record and playback
  • 68. Automating Examples • Start small • Select important examples for automation • Plan up-front to automate • Be prepared to go slower at the start • Treat automation code as a first class citizen • Avoid record and playback • Avoid using pre-populated data
  • 70. Automation Tools FitNesse Cucumber Concordian Green JBehave Twist Pepper Robot Text Test SpecFlow Framework
  • 72. Validate Frequently • Start with a Continuous Integration system
  • 73. Validate Frequently • Start with a Continuous Integration system • Set up a Continuous Deployment system
  • 74. Validate Frequently • Start with a Continuous Integration system • Set up a Continuous Deployment system • Specify and test business logic separately from end-to-end flows
  • 75. Validate Frequently • Start with a Continuous Integration system • Set up a Continuous Deployment system • Specify and test business logic separately from end-to-end flows • Organize tests along functional lines
  • 76. Validate Frequently • Start with a Continuous Integration system • Set up a Continuous Deployment system • Specify and test business logic separately from end-to-end flows • Organize tests along functional lines • Run all test nightly
  • 77. Validate Frequently • Start with a Continuous Integration system • Set up a Continuous Deployment system • Specify and test business logic separately from end-to-end flows • Organize tests along functional lines • Run all test nightly • Consider an iteration “test pack”
  • 78. Living Documentation • Keep specifications short • Evolve a specification language and leverage in with “common fixtures” • Make documentation accessible - consider a wiki • Organize the documentation • Put specifications under version control
  • 81. Cucumber Organization fixtures are common Features Step System
  • 82. Cucumber Organization fixtures are common ad Lo Features Step System
  • 83. Cucumber Organization fixtures are common M ad at Lo ch Features Step System
  • 84. Cucumber Organization fixtures are common M ad at Lo ch Features Step Call System
  • 85. Feature File Feature: Turn cucumber into beer As a cucumber presenter I want beer after my presentation So I can enjoy the rest of DemoCampGuelph Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Scenario: Ali buys Declan beer Given Ali hosts DemoCampGuelph When Declan demos Cucumber Then Ali should buy Declan 1 beer
  • 86. Step Definitions Given /^(.+) hosts/ do |host| @event = Event.new(host) end When /^(.+) demos/ do |presenter| @event.add(presenter) end Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker perk.quantity.should == quantity.to_i; perk.item.should == item end
  • 87. System Under Test class Event attr_reader :perks def initialize(host) @host = host; @perks = [] end def add(presenter) @perks.push Perk.new(@host, presenter, 1, "beer") end end class Perk attr_reader :buyer, :receiver, :quantity, :item def initialize(buyer, receiver, quantity, item) @buyer = buyer; @receiver = receiver @quantity = quantity; @item = item end end
  • 88. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer
  • 89. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Given /^(.+) hosts/ do | When /^(.+) demos/ do | host| presenter| @event = @event.add(presenter) Event.new(host) end End Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker
  • 90. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Given /^(.+) hosts/ do | host| @event = Event.new(host) End
  • 91. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Given /^(.+) hosts/ do | host| “Brydon” @event = Event.new(host) End
  • 92. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer
  • 93. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Given /^(.+) hosts/ do | When /^(.+) demos/ do | host| presenter| @event = @event.add(presenter) Event.new(host) end End Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker
  • 94. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer When /^(.+) demos/ do | presenter| @event.add(presenter) end
  • 95. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer When /^(.+) demos/ do | presenter| @event.add(presenter) end “Declan”
  • 96. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer
  • 97. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Given /^(.+) hosts/ do | When /^(.+) demos/ do | host| presenter| @event = @event.add(presenter) Event.new(host) end End Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker
  • 98. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker
  • 99. Execution Scenario: Brydon buys Declan beer Given Brydon hosts DemoCampGuelph When Declan demos Cucumber Then Brydon should buy Declan 1 beer Then /^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item| perk = @event.perks[0]; perk.buyer.should == buyer; perk.receiver.should == drinker
  • 100. Source: https://docs.google.com/drawings/d/1cbfKq-KazcbMVCnRfih6zMSDBdtf90KviV7l2oxGyWM/edit Specification By Example Business Goal Derive the scope Scope Shared Understanding Ubiquitous Language Specify collaboratively Key Examples Refine the specification Specification With Examples Automate literally Executable Specification Validate frequently Living Documentation
  • 101. Build it Right Build the Right Thing Specification By Example Gojko Adzic, 2011 page 4
  • 102. Build it Right Build the Right Thing Useless Crap Specification By Example Gojko Adzic, 2011 page 4
  • 103. Build it Right Business Failure Build the Right Thing Useless Crap Specification By Example Gojko Adzic, 2011 page 4
  • 104. Build it Right Business Failure Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 105. Build it Right Business Failure Business Success Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 106. Build it Right Business Failure Business Success Specification By Example Build the Right Thing Useless Crap Maintenance Nightmare Specification By Example Gojko Adzic, 2011 page 4
  • 107. Reading Specification By Example Gojko Adzic The RSpec Book: Behaviour Driven Development with RSpec, Cucumber and Friends David Cheliminksy et al Agile Testing: A Practical Guide for Testers and Agile Teams Lisa Crispin, Janet Gregory
  • 108. Diagram Credits Lisa Crispin and Janet Gregory Agile Testing: A Practical Guide for Testers and Agile Teams Addison-Wesley Professional; January 9, 2009. Mike Cohn Succeeding with Agile: Software Development Using Scrum Addison-Wesley Professional; November 5, 2009.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n