Upcoming SlideShare
×

Specification by Example

1,854 views

Published on

Lead by Example - How to Ensure Your Team Builds the Right Solution was presented at the 2012 DC Agile Engineering Conference on 12/7/2012 by Rebecca Halstead and Stephen Ritchie (@

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
1,854
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
77
0
Likes
0
Embeds 0
No embeds

No notes for slide
• 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
• Given a preconditionWhen an action happensThen the following post-conditions should be satisfied
• Specification by Example

1. 1. #DCAEC12
2. 2. Specification by Example at theOffice of Personnel Management #DCAEC12
3. 3. Lead byExample Building Testable Requirements 4 #DCAEC12
4. 4. 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
5. 5. 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
6. 6. 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
7. 7. 5. AcceptanceExample 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 pets1 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
8. 8. 5. Acceptance 1. Feature 2. User StoryCollaborate 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
9. 9. 5. AcceptanceDefine 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
10. 10. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Acceptance Criteria 6. ExamplesCriteria 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 Results5 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
11. 11. Acceptance 1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Acceptance Criteria 6. ExamplesCriteria (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
12. 12. 5. AcceptanceExamples 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 Adzic6 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
13. 13. 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
14. 14. Concordion Example 15 #DCAEC12
15. 15. Concordion Example 16 #DCAEC12