specification by example

24
Lead by Example How to ensure your team builds the right solution

Upload: excella-consulting

Post on 12-May-2015

1.053 views

Category:

Documents


4 download

DESCRIPTION

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 (@

TRANSCRIPT

Page 1: Specification by Example

Lead by ExampleHow to ensure your team buildsthe right solution

Page 2: Specification by Example

How do you know that you have delivered the right solution?

What are the limitations of that approach?

#DCAEC12

Page 3: Specification by Example

Specification by Example at the Office of Personnel Management

#DCAEC12

Page 4: Specification by Example

4

Lead by Example

Building Testable

Requirements

#DCAEC12

Page 5: Specification by Example

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

Page 6: Specification by Example

Exercise #2

Time how long it takes to determine the calculation:

Annuity Supplement

The annuity supplement is computed as if you were age 62 and fully insured for a social security benefit when the supplement begins.

1. First, an estimate of what your full career (40 years of service) social security benefit would be is needed.

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.

For example, if your estimated full career social security benefit would be $1,000 and you had worked 30 years under FERS, we would divide 30 by 40 (.75) and multiply ($1,000 x .75 = $750).

Annuity Supplement = Estimated Benefit x (Actual Years Service/40)

#DCAEC12

Page 7: Specification by Example

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

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

#DCAEC12

Page 8: Specification by Example

Example

8

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

As a registered pet owner, I want to search online,

So that I can know if my lost pet has been found

Product Backlog Allow companies to provide data Allow shelters and vet clinics to report a

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...

Allow registered users to search for missing pets

1 2

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

#DCAEC12

Page 9: Specification by Example

Collaborate

9

1. Feature 2. User Story

3. Collaborate 4. Scenarios

5. Acceptance

Criteria6. Examples

◊ Builds a shared understanding

◊ Prepare in advance to ensure similar domain knowledge

◊ Factors in other perspectives (e.g. business analyst, tester, developer)

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

Confirm and Clarify:1.Only registered users2.Microchip ID is unique3.Can search by Microchip ID,

Phone Number, and Email Address

4.Wildcard searches are not allowed, exact match only

3

#DCAEC12

Page 10: Specification by Example

Define Scenarios

10

1. Feature 2. User Story

3. Collaborate 4. Scenarios

5. Acceptance

Criteria6. Examples

◊ Scenarios are the outline

◊ Use plain language to describe the scenario

◊ Encourages conversation

◊ Helps determine if the story is sized right

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

Scenarios:1.Search with Results2.Search without Results

4

#DCAEC12

Page 11: Specification by Example

AcceptanceCriteria

11

1. Feature 2. User Story

3. Collaborate 4. Scenarios

5. Acceptance

Criteria6. Examples

Given a registered pet owner And their lost pet is in the databaseAnd their lost pet is flagged as foundWhen that pet owner searches by <search parameter>Then search results are returned

Given a registered pet ownerAnd (their lost pet is not in the database

OR (their lost pet is in the database AND 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

Scenario #1: Search with Results

Scenario #2: Search without Results5

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

5

#DCAEC12

Page 12: Specification by Example

AcceptanceCriteria (cont.)

12

1. Feature 2. User Story

3. Collaborate 4. Scenarios

5. Acceptance

Criteria6. Examples

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

Format:

Given [context]When [event]

Then [expected behavior]

#DCAEC12

Page 13: Specification by Example

Examples

13

1. Feature 2. User Story

3. Collaborate 4. Scenarios

5. Acceptance

Criteria6. Examples

Search Parameter(s) Search Result(s)

Microchip ID Phone Number Email Address Pet Name

A1297-98 Fluffy

703-555-1212 Ginger

[email protected] RalphB4318393 202-874-9855 Bingo

“…illustrating requirements using examples is a much more effective technique than specifying with abstract requirements. Because examples are concrete and unambiguous, they’re an ideal tool for making requirements precise – this is why we use them to clarify meaning in everyday communication.”

--Specification by Example, Gojko Adzic

Given a registered pet owner And their lost pet is in the databaseAnd their lost pet is flagged as foundWhen that pet owner searches by <search parameter>Then search results are returned

Scenario #1: Search with Results

6

#DCAEC12

Page 14: Specification by Example

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

Page 15: Specification by Example

Concordion Example

15#DCAEC12

Page 16: Specification by Example

Concordion Example

16#DCAEC12

Page 18: Specification by Example

GROUP EXERCISE

18

Page 19: Specification by Example

Group Exercise

19

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

Page 20: Specification by Example

Group Exercise (cont.)

1. Define at least 3 scenarios2. Determine acceptance criteria for at least 1 scenario3. Identify examples that can validate the acceptance

criteria

20

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

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

Page 21: Specification by Example

User Story #1 - Scenarios

21

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

Page 22: Specification by Example

User Story #1 – Acceptance Criteria

22

(1) Successful account creationGiven 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 takenGiven 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

Page 23: Specification by Example

User Story #1 – Acceptance Criteria (cont.)

23

(3) Incorrect Email Address FormatGiven 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 requirementsGiven an unauthenticated user

When a user provides <username>, <password>, <confirmation>

Then an error message is presented to the user

(5) Passwords do not matchGiven an unauthenticated user

When a user provides <username>, <password>, <confirmation>

Then an error message is presented to the user

Page 24: Specification by Example

User Story #1 - Examples

24

Scenario Username Password Confirmation Email Address Message Result

1 rhalstead excella01! excella01! [email protected] Your personal site was successfully created.

Pass

2 rhalstead excella02! excella02! [email protected] The username entered is already in use. Please enter another username.

Fail

3 rhalstead99 excella03! excella03! ron.halsteadcompany.net Your email address is invalid. Fail4 rhalstead101 excella excella [email protected] Your password does not comply with

security requirements.Fail

5 zeus2000 excella05! excella05 [email protected] Your passwords do not match. Fail

5 zeus200 excella05! [email protected] Your passwords do not match. Fail