SlideShare a Scribd company logo
Specification by Example
#DCAEC12
Specification by Example at the
Office of Personnel Management




        #DCAEC12
Lead by
Example
            Building
            Testable
          Requirements



                         4
             #DCAEC12
Exercise #1

 Time how long it takes to understand
 the following:
 ◊ Yellow Circle

 ◊ Divide the circle into two sections – top
   and bottom

 ◊ In the top section, there are two black
   dots equidistant from the center

 ◊ In the bottom section, there is curved arc
   that dips in the center with two smaller
   curved arcs on each end of the larger arc



                                   #DCAEC12
Exercise #2
 Time how long it takes to
 determine the calculation:
 Annuity Supplement
                                             For example, if your estimated full
 The annuity supplement is computed          career social security benefit would
 as if you were age 62 and fully insured     be $1,000 and you had worked 30
 for a social security benefit when the
 supplement begins.                          years under FERS, we would divide 30
                                             by 40 (.75) and multiply ($1,000 x .75
 1.   First, an estimate of what your full   = $750).
      career (40 years of service) social
      security benefit would be is
      needed.                                Annuity Supplement = Estimated
                                             Benefit x (Actual Years Service/40)
 2.   Then the actual amount of your
      civilian service is determined.
 3.   Finally, the estimated full career
      social security benefit is reduced
      by the employee’s actual service.
                                    #DCAEC12
Specification by Example

  Specification by Example is a technique for ensuring that there is
  a shared understanding of what a given requirement, product
  backlog item, or a feature entails



                                                               5. Acceptance
  1. Feature   2. User Story   3. Collaborate   4. Scenarios
                                                                   Criteria
                                                                               6. Examples




                                        #DCAEC12
5. Acceptance

Example
                             1. Feature   2. User Story   3. Collaborate   4. Scenarios                   6. Examples
                                                                                              Criteria




                           Develop a website that allows information about
                           microchipped pets from multiple chip providers to be used
                           for finding missing pets

1                                                                          2
    Product Backlog                                                                        As a registered pet owner,
     Allow companies to provide data                                                       I want to search online,
     Allow shelters and vet clinics to report a                               So that I can know if my lost pet has been found
      missing pet
     Allow users to register their pet
     Allow pet owners to update their
      contact information
     Alert pet owners if their pet has been
      found
     Allow registered users to search for
      missing pets
      .
      .
      .

                                                                                                                                  8
                                                             #DCAEC12
5. Acceptance
                  1. Feature   2. User Story

Collaborate
                                               3. Collaborate   4. Scenarios                   6. Examples
                                                                                   Criteria




  Example: As a registered pet owner, I want to search online, so
  that I can know if my lost pet has been found.

                                                                               3

  ◊ Builds a shared understanding                                                  Confirm and Clarify:
                                                                                     1. Only registered users
  ◊ Prepare in advance to ensure                                                     2. Microchip ID is unique
    similar domain knowledge                                                         3. Can search by Microchip
                                                                                        ID, Phone Number, and
  ◊ Factors in other perspectives (e.g.                                                 Email Address
    business                                                                         4. Wildcard searches are not
    analyst, tester, developer)                                                         allowed, exact match only




                                                                                                                    9
                                                 #DCAEC12
5. Acceptance

Define Scenarios       1. Feature   2. User Story   3. Collaborate   4. Scenarios
                                                                                         Criteria
                                                                                                     6. Examples




  Example: As a registered pet owner, I want to search online, so
  that I can know if my lost pet has been found.


  ◊ Scenarios are the outline                                            4
                                                                                    Scenarios:
  ◊ Use plain language to describe the                                              1. Search with Results
    scenario                                                                        2. Search without Results

  ◊ Encourages conversation
  ◊ Helps determine if the story is
    sized right



                                                                                                                   10
                                       #DCAEC12
Acceptance                      1. Feature   2. User Story   3. Collaborate    4. Scenarios
                                                                                              5. Acceptance
                                                                                                  Criteria
                                                                                                              6. Examples



Criteria
    Example: As a registered pet owner, I want to search online, so
    that I can know if my lost pet has been found.

        Scenario #1: Search with Results
5
    Given a registered pet owner                                              Scenario #2: Search without Results
    And their lost pet is in the database                         5
    And their lost pet is flagged as found
                                                                      Given a registered pet owner
    When that pet owner searches by <search
                                                                      And (their lost pet is not in the database
    parameter>
                                                                           OR (their lost pet is in the database AND
    Then search results are returned
                                                                           not tagged as found)
                                                                           OR the <search parameter> is invalid)
                                                                      When that pet owner searches by <search
                                                                      parameter>
                                                                      Then no search results are returned
                                                                           And a message displays


                                                                                                                            11
                                                     #DCAEC12
Acceptance                1. Feature   2. User Story   3. Collaborate   4. Scenarios
                                                                                       5. Acceptance
                                                                                           Criteria
                                                                                                       6. Examples



Criteria (cont.)
   The conditions of satisfaction or acceptance criteria can be
   bullet points or described in a Given-When-Then template
   – One action ensures focus only on that action; direct cause and effect
     relationship
   – Express business functionality, not flows of interactions




                                                                                                                     12
                                               #DCAEC12
5. Acceptance

Examples                   1. Feature   2. User Story   3. Collaborate   4. Scenarios
                                                                                            Criteria
                                                                                                        6. Examples




       Scenario #1: Search with Results                                  “…illustrating requirements using examples is a
                                                                         much more effective technique than specifying with
    Given a registered pet owner                                         abstract requirements. Because examples are
    And their lost pet is in the database                                concrete and unambiguous, they’re an ideal tool for
    And their lost pet is flagged as found                               making requirements precise – this is why we use
    When that pet owner searches by <search                              them to clarify meaning in everyday
    parameter>                                                           communication.”
    Then search results are returned
                                                                                              --Specification by Example, Gojko Adzic


6
                         Search Parameter(s)                                                                     Search Result(s)
    Microchip ID       Phone Number                          Email Address                                   Pet Name
    A1297-98                                                                                                 Fluffy
                       703-555-1212                                                                          Ginger
                                                             john.smith@gmail.com                            Ralph
    B4318393           202-874-9855                                                                          Bingo

                                                                                                                                    13
                                                          #DCAEC12
Tools

   Tabular Style Requirements (data-centric)
           FitNesse (http://fitnesse.org/)
           Fit (http://fit.c2.com/)
           Concordion (http://www.concordion.org/)
           Robot Framework (http://code.google.com/p/robotframework/)

   Behavior Driven Development (process-centric)
           Cucumber (http://cukes.info/)
           GreenPepper (http://www.greenpeppersoftware.com)
           easyb (http://www.easyb.org/)
           Selenium (http://seleniumhq.org/)
           RSpec (http://rspec.info/)
           SpecFlow (http://www.specflow.org/)
           JBehave (http://jbehave.org/)
           Twist (http://www.thoughtworks-studios.com/twist-agile-testing)


                  http://specificationbyexample.com/resources.html

                                        #DCAEC12
Concordion Example




                                15
                     #DCAEC12
Concordion Example




                                16
                     #DCAEC12
Contact Information

                  Rebecca Halstead
                  rebecca.halstead@excella.com
                  http://excella.com/people/rebecca-halstead.aspx




                  Stephen Ritchie
                  stephen.ritchie@excella.com
                  http://www.linkedin.com/in/sritchie
                  http://www.excella.com/people/stephen-ritchie.aspx


                                                                    17
                       #DCAEC12
GROUP EXERCISE


                 18
Group Exercise

  You are responsible for eliciting and documenting the requirements for your
  client’s new website, FaceSpace©, a competitor to Facebook. You start with
  the following features from the Product Backlog:
  –   Sign Up / Register
  –   Add a Friend
  –   Upload a Picture
  –   Post a Status Update
  –   Like a Status Update
  –   Reply to a Friend's Status Update
  –   Tag a Friend in a Picture
  –   Update Your Profile




                                                                                19
Group Exercise (cont.)

1. Define at least 3 scenarios
2. Determine acceptance criteria for at least 1 scenario
3. Identify examples that can validate the acceptance
   criteria

          As a potential user, I want to sign-up for a FaceSpace
          account, so that I can customize my own FaceSpace page


                                                               5. Acceptance
  1. Feature   2. User Story   3. Collaborate   4. Scenarios
                                                                   Criteria
                                                                               6. Examples




                                                                                             20
User Story #1 - Scenarios

  As a potential user, I want to sign-up for a FaceSpace account, so that I can
  customize my own FaceSpace page

  “Create Account” Scenarios
      – Successful account creation
      – Username already taken
      – Incorrect email address format
      – Password does not meet security requirements
      – Passwords do not match




                                                                                  21
User Story #1 – Acceptance Criteria

  (1) Successful account creation
      Given an unauthenticated user
      When that user provides correct account sign-up data
      Then an account is created
          And a unique web page is created
          And an email confirmation is sent


  (2) Username already taken
      Given an unauthenticated user
      When that user provides a username that is associated to an existing FaceSpace account
      Then an error message is presented to the user




                                                                                               22
User Story #1 – Acceptance Criteria (cont.)

  (3) Incorrect Email Address Format
      Given an unauthenticated user
      When that user provides an incorrect email address
      Then an error message is presented to the user


  (4) Password does not meet security requirements
      Given an unauthenticated user
      When a user provides <username>, <password>, <confirmation>
      Then an error message is presented to the user


  (5) Passwords do not match
      Given an unauthenticated user
      When a user provides <username>, <password>, <confirmation>
      Then an error message is presented to the user


                                                                    23
User Story #1 - Examples


 Scenario Username    Password     Confirmation Email Address                 Message                              Result
 1       rhalstead    excella01!   excella01!   rebecca.halstead@excella.com Your personal site was successfully   Pass
                                                                             created.
 2       rhalstead    excella02!   excella02!   rosalie.halstead@company.org The username entered is already in    Fail
                                                                             use. Please enter another username.
 3       rhalstead99 excella03!    excella03!   ron.halsteadcompany.net      Your email address is invalid.        Fail
 4       rhalstead101 excella      excella      robin.halstead@agency.gov    Your password does not comply with    Fail
                                                                             security requirements.
 5       zeus2000     excella05!   excella05    John.Smith2000@gmail.com     Your passwords do not match.          Fail

 5       zeus200      excella05!                John.Smith2000@gmail.com      Your passwords do not match.         Fail




                                                                                                                            24

More Related Content

KEY
Specification by Example
PPTX
Specifications For Enterprise Testing
PPTX
Specification by Example
PPTX
Gypsum products in Dentistry
PDF
HR Business Partner: Roles and Responsibilities
PDF
service quality & usability
PDF
Alla ricerca della user story perduta
PDF
Alla ricerca della User Story perduta
Specification by Example
Specifications For Enterprise Testing
Specification by Example
Gypsum products in Dentistry
HR Business Partner: Roles and Responsibilities
service quality & usability
Alla ricerca della user story perduta
Alla ricerca della User Story perduta

Similar to Specification by Example (20)

PDF
Biz Req Checklist1
DOCX
Nick Hatheway Dma Competencies 2011 12
PPTX
Clearance barriers to Cyber Security Profession
PDF
Snapp high edweb_2010
DOCX
Dma Competencies 2011 12
PDF
Task analysis in service design
PDF
Simmons College - Fluency with Information Technology
PPTX
랭킹 최적화를 넘어 인간적인 검색으로 - 서울대 융합기술원 발표
PDF
Producing Testable Requirements
PDF
Contract management from creation through execution and monitoring 26 july 2011
PDF
Practical Uses of SharePoint a Redengine Webinar
PDF
Practical Uses of SharePoint - Webinar January 27, 2009
PPTX
Webinar - Maximizing Requirements Value Throughout the Product Lifecycle
PPSX
Rapid Iterative Design: A Minimalist Approach to Requirements-Gathering and I...
PDF
Scale, Structure, and Semantics
PDF
2012 11 7 TAR Webinar Part 3 Sigler
PDF
Embedded storycrafting
PDF
Validating Ideas Through Prototyping
PDF
Interoperability framework overview
PDF
Improving Findability Inside the Firewall
Biz Req Checklist1
Nick Hatheway Dma Competencies 2011 12
Clearance barriers to Cyber Security Profession
Snapp high edweb_2010
Dma Competencies 2011 12
Task analysis in service design
Simmons College - Fluency with Information Technology
랭킹 최적화를 넘어 인간적인 검색으로 - 서울대 융합기술원 발표
Producing Testable Requirements
Contract management from creation through execution and monitoring 26 july 2011
Practical Uses of SharePoint a Redengine Webinar
Practical Uses of SharePoint - Webinar January 27, 2009
Webinar - Maximizing Requirements Value Throughout the Product Lifecycle
Rapid Iterative Design: A Minimalist Approach to Requirements-Gathering and I...
Scale, Structure, and Semantics
2012 11 7 TAR Webinar Part 3 Sigler
Embedded storycrafting
Validating Ideas Through Prototyping
Interoperability framework overview
Improving Findability Inside the Firewall
Ad

More from Excella (20)

PDF
DCSUG - What's Really Going On? Observer Worksheet
PDF
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
PDF
DCSUG - Servant Leadership Handout
PDF
DCSUG - Servant Leadership
PDF
DCSUG - Applying Analysis in an Agile World
PDF
DCSUG - The Art and Practice of the Agile Leader
PPTX
DCSUG - Finding Lean in Agile
PDF
DCSUG - Impact Mapping
PDF
DCSUG - Happiness: A Key Component of Agile
PPTX
The Awkward Teenager of Testing
PDF
Let's Sharpen Your Agile Ax, It's Story Splitting Time
PDF
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
PDF
The 7 Secrets of Highly Effective Retrospectives (DCSUG)
PPTX
Get Your Productivity Game On!!
PPTX
How to Structure Multi Team Organizations
PPTX
Tactics to Kickstart Your Journey Toward DevOps
PPTX
Intro to Mocking - DjangoCon 2015
PPTX
Tactics to Kickstart Your Journey Toward Continuous Delivery
PPTX
Using ansible vault to protect your secrets
PDF
Using Lean Thinking to Increase the Value of Agile
DCSUG - What's Really Going On? Observer Worksheet
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
DCSUG - Servant Leadership Handout
DCSUG - Servant Leadership
DCSUG - Applying Analysis in an Agile World
DCSUG - The Art and Practice of the Agile Leader
DCSUG - Finding Lean in Agile
DCSUG - Impact Mapping
DCSUG - Happiness: A Key Component of Agile
The Awkward Teenager of Testing
Let's Sharpen Your Agile Ax, It's Story Splitting Time
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
The 7 Secrets of Highly Effective Retrospectives (DCSUG)
Get Your Productivity Game On!!
How to Structure Multi Team Organizations
Tactics to Kickstart Your Journey Toward DevOps
Intro to Mocking - DjangoCon 2015
Tactics to Kickstart Your Journey Toward Continuous Delivery
Using ansible vault to protect your secrets
Using Lean Thinking to Increase the Value of Agile
Ad

Specification by Example

  • 3. Specification by Example at the Office of Personnel Management #DCAEC12
  • 4. Lead by Example Building Testable Requirements 4 #DCAEC12
  • 5. Exercise #1 Time how long it takes to understand the following: ◊ Yellow Circle ◊ Divide the circle into two sections – top and bottom ◊ In the top section, there are two black dots equidistant from the center ◊ In the bottom section, there is curved arc that dips in the center with two smaller curved arcs on each end of the larger arc #DCAEC12
  • 6. Exercise #2 Time how long it takes to determine the calculation: Annuity Supplement For example, if your estimated full The annuity supplement is computed career social security benefit would as if you were age 62 and fully insured be $1,000 and you had worked 30 for a social security benefit when the supplement begins. years under FERS, we would divide 30 by 40 (.75) and multiply ($1,000 x .75 1. First, an estimate of what your full = $750). career (40 years of service) social security benefit would be is needed. Annuity Supplement = Estimated Benefit x (Actual Years Service/40) 2. Then the actual amount of your civilian service is determined. 3. Finally, the estimated full career social security benefit is reduced by the employee’s actual service. #DCAEC12
  • 7. Specification by Example Specification by Example is a technique for ensuring that there is a shared understanding of what a given requirement, product backlog item, or a feature entails 5. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios Criteria 6. Examples #DCAEC12
  • 8. 5. Acceptance Example 1. Feature 2. User Story 3. Collaborate 4. Scenarios 6. Examples Criteria Develop a website that allows information about microchipped pets from multiple chip providers to be used for finding missing pets 1 2 Product Backlog As a registered pet owner,  Allow companies to provide data I want to search online,  Allow shelters and vet clinics to report a So that I can know if my lost pet has been found missing pet  Allow users to register their pet  Allow pet owners to update their contact information  Alert pet owners if their pet has been found  Allow registered users to search for missing pets . . . 8 #DCAEC12
  • 9. 5. Acceptance 1. Feature 2. User Story Collaborate 3. Collaborate 4. Scenarios 6. Examples Criteria Example: As a registered pet owner, I want to search online, so that I can know if my lost pet has been found. 3 ◊ Builds a shared understanding Confirm and Clarify: 1. Only registered users ◊ Prepare in advance to ensure 2. Microchip ID is unique similar domain knowledge 3. Can search by Microchip ID, Phone Number, and ◊ Factors in other perspectives (e.g. Email Address business 4. Wildcard searches are not analyst, tester, developer) allowed, exact match only 9 #DCAEC12
  • 10. 5. Acceptance Define Scenarios 1. Feature 2. User Story 3. Collaborate 4. Scenarios Criteria 6. Examples Example: As a registered pet owner, I want to search online, so that I can know if my lost pet has been found. ◊ Scenarios are the outline 4 Scenarios: ◊ Use plain language to describe the 1. Search with Results scenario 2. Search without Results ◊ Encourages conversation ◊ Helps determine if the story is sized right 10 #DCAEC12
  • 11. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Acceptance Criteria 6. Examples Criteria Example: As a registered pet owner, I want to search online, so that I can know if my lost pet has been found. Scenario #1: Search with Results 5 Given a registered pet owner Scenario #2: Search without Results And their lost pet is in the database 5 And their lost pet is flagged as found Given a registered pet owner When that pet owner searches by <search And (their lost pet is not in the database parameter> OR (their lost pet is in the database AND Then search results are returned not tagged as found) OR the <search parameter> is invalid) When that pet owner searches by <search parameter> Then no search results are returned And a message displays 11 #DCAEC12
  • 12. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Acceptance Criteria 6. Examples Criteria (cont.) The conditions of satisfaction or acceptance criteria can be bullet points or described in a Given-When-Then template – One action ensures focus only on that action; direct cause and effect relationship – Express business functionality, not flows of interactions 12 #DCAEC12
  • 13. 5. Acceptance Examples 1. Feature 2. User Story 3. Collaborate 4. Scenarios Criteria 6. Examples Scenario #1: Search with Results “…illustrating requirements using examples is a much more effective technique than specifying with Given a registered pet owner abstract requirements. Because examples are And their lost pet is in the database concrete and unambiguous, they’re an ideal tool for And their lost pet is flagged as found making requirements precise – this is why we use When that pet owner searches by <search them to clarify meaning in everyday parameter> communication.” Then search results are returned --Specification by Example, Gojko Adzic 6 Search Parameter(s) Search Result(s) Microchip ID Phone Number Email Address Pet Name A1297-98 Fluffy 703-555-1212 Ginger john.smith@gmail.com Ralph B4318393 202-874-9855 Bingo 13 #DCAEC12
  • 14. Tools Tabular Style Requirements (data-centric)  FitNesse (http://fitnesse.org/)  Fit (http://fit.c2.com/)  Concordion (http://www.concordion.org/)  Robot Framework (http://code.google.com/p/robotframework/) Behavior Driven Development (process-centric)  Cucumber (http://cukes.info/)  GreenPepper (http://www.greenpeppersoftware.com)  easyb (http://www.easyb.org/)  Selenium (http://seleniumhq.org/)  RSpec (http://rspec.info/)  SpecFlow (http://www.specflow.org/)  JBehave (http://jbehave.org/)  Twist (http://www.thoughtworks-studios.com/twist-agile-testing) http://specificationbyexample.com/resources.html #DCAEC12
  • 15. Concordion Example 15 #DCAEC12
  • 16. Concordion Example 16 #DCAEC12
  • 17. Contact Information Rebecca Halstead rebecca.halstead@excella.com http://excella.com/people/rebecca-halstead.aspx Stephen Ritchie stephen.ritchie@excella.com http://www.linkedin.com/in/sritchie http://www.excella.com/people/stephen-ritchie.aspx 17 #DCAEC12
  • 19. Group Exercise You are responsible for eliciting and documenting the requirements for your client’s new website, FaceSpace©, a competitor to Facebook. You start with the following features from the Product Backlog: – Sign Up / Register – Add a Friend – Upload a Picture – Post a Status Update – Like a Status Update – Reply to a Friend's Status Update – Tag a Friend in a Picture – Update Your Profile 19
  • 20. Group Exercise (cont.) 1. Define at least 3 scenarios 2. Determine acceptance criteria for at least 1 scenario 3. Identify examples that can validate the acceptance criteria As a potential user, I want to sign-up for a FaceSpace account, so that I can customize my own FaceSpace page 5. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios Criteria 6. Examples 20
  • 21. User Story #1 - Scenarios As a potential user, I want to sign-up for a FaceSpace account, so that I can customize my own FaceSpace page “Create Account” Scenarios – Successful account creation – Username already taken – Incorrect email address format – Password does not meet security requirements – Passwords do not match 21
  • 22. User Story #1 – Acceptance Criteria (1) Successful account creation Given an unauthenticated user When that user provides correct account sign-up data Then an account is created And a unique web page is created And an email confirmation is sent (2) Username already taken Given an unauthenticated user When that user provides a username that is associated to an existing FaceSpace account Then an error message is presented to the user 22
  • 23. User Story #1 – Acceptance Criteria (cont.) (3) Incorrect Email Address Format Given an unauthenticated user When that user provides an incorrect email address Then an error message is presented to the user (4) Password does not meet security requirements Given an unauthenticated user When a user provides <username>, <password>, <confirmation> Then an error message is presented to the user (5) Passwords do not match Given an unauthenticated user When a user provides <username>, <password>, <confirmation> Then an error message is presented to the user 23
  • 24. User Story #1 - Examples Scenario Username Password Confirmation Email Address Message Result 1 rhalstead excella01! excella01! rebecca.halstead@excella.com Your personal site was successfully Pass created. 2 rhalstead excella02! excella02! rosalie.halstead@company.org The username entered is already in Fail use. Please enter another username. 3 rhalstead99 excella03! excella03! ron.halsteadcompany.net Your email address is invalid. Fail 4 rhalstead101 excella excella robin.halstead@agency.gov Your password does not comply with Fail security requirements. 5 zeus2000 excella05! excella05 John.Smith2000@gmail.com Your passwords do not match. Fail 5 zeus200 excella05! John.Smith2000@gmail.com Your passwords do not match. Fail 24

Editor's Notes

  • #2: Point of exercises is not to demonstrate that you cannot determine the requirements without an example, but the examples allow you to understand the requirement more efficiently and with less ambiguity
  • #4: Given a preconditionWhen an action happensThen the following post-conditions should be satisfied