Agile Requirements are lightweight by design, so what can you do as the BA to convey requirements in a concise yet comprehensive way? How can you include real examples in your requirements to increase clarity and reduce ambiguity when working with your team?
In this presentation, Rebecca Halstead shares how to incorporate examples in your requirements as a way to encourage collaboration and build a shared understanding about the acceptance criteria. Rebecca delivered this presentation on Agile Requirements at the International Institute of Business Analysis, DC Chapter meeting on March 20, 2014.
2. Speaker Bio
2
• Excella Business Analysis
Center of Excellence Lead
• CBAP, PMP, PMI-ACP,
CSM, CSPO
• President of the IIBA DC
Chapter
• Contact Information:
– rebecca.halstead@excella.com
– http://excella.com/people/rebecca-
halstead.aspx
3. • Specification by Example
• Executable Specifications
• Scenarios
• Automated Acceptance Tests (AAT)
• Behavior Driven Development (BDD)
• Acceptance Test Driven Development
(AATDD)
• Gherkin Syntax
Today’s Topic
3
Requirements using Examples
9. • Using Examples:
– Makes abstract
concepts more
relatable
– Minimizes
misinterpretation
– Highlights
success,
alternative and
exception cases
How do you specify the right amount?
9
14. Background:
You are developing an
online ordering website
for a local company that
grows, harvests and sells
botanicals directly to
customers.
Feature:
Calculate customer order
Feature
14
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
16. User Story:
As a customer, I want to review shipping costs in
my shopping cart before checking out, so that I
can see if I will receive free shipping.
User Story
16
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
17. Collaborate
17
How do I
describe
what I
want?
How do I
validate
that this
work is
done?
How do I
code this
feature?
What are
the details
of this
feature?
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
19. Scenario: Standard Shipping Rate
Given I am a customer
And my order amount is $49.99
When I view my cart
Then I see that shipping costs are $3.99
Scenarios
19
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
20. Scenario: Free Shipping Rate
Given I am a customer
And my order amount is $50.00
When I view my cart
Then I see no shipping costs
Scenarios
20
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
21. Scenario Outline: Shipping Rate
Given I am a customer
And my order amount is “<order_total>”
When I view my cart
Then I see the “<shipping_cost>”
Scenarios
21
1. Feature 2. User Story 3. Collaborate 4. Scenarios 5. Examples
23. Alternate Method
23
Story As a customer, I want to review shipping costs in my shopping cart before
checking out, so that I can see if I will receive free shipping.
Scenario Customer adds less than $50.00 worth of botanicals to his cart.
Business Rule Standard shipping for orders under $50.00 and free for orders over $50.00.
GIVEN
Precondition(s) Order amount: $49.99
Fixed Data Product Id: 12299
Quantity: 3
WHEN
Action View cart
Input Data
THEN
Output Data Shipping cost = $3.99
Postcondition Shipping rate determined
Based on examples from: http://ebgconsulting.com
24. Feature: Application Access
Scenario: User with valid credentials
Imperative (Narrative)
GIVEN I am an unauthenticated user
AND I am on the login page
AND I enter a valid name in the Name field
AND I enter the corresponding password in the Password field
WHEN I select the Login button
THEN I should see the welcome page
Imperative Style…
24
Implementation Detail – what if
decide to use Token-based
authentication or single sign-on?
UI Detail – what if the user interface
changes and you select name from
a drop-down list or select a radio
button?
25. Feature: Application Access
Scenario: User with valid credentials
Declarative (Informative)
GIVEN I am an unauthenticated user
AND I am on the login page
WHEN I submit valid credentials
THEN I should see the welcome page
Declarative Style…
25
26. Feature: Application Access
Scenario: User with valid credentials
Side-by-side Comparison
26
Imperative (Narrative) Declarative (Informative)
GIVEN I am an unauthenticated user
AND I am on the login page
AND I enter a valid name in the Name field
AND I enter the corresponding password
in the Password field
WHEN I select the Login button
THEN I should see the welcome page
GIVEN I am an unauthenticated user
AND I am on the login page
WHEN I submit valid credentials
THEN I should see the welcome page
27. —If the user interface is constantly changing, it is better to
use imperative.
—Declarative is easier to maintain.
—Developers prefer the imperative style.
—If a stakeholder is concerned about the user’s interaction
experience, use imperative.
—Declarative specifies implementation details.
Myth or Fact?
27
28. • Make each line of the acceptance criteria
stand on its own
• Use active voice, not passive
• Have a single action trigger the expected
behavior (WHEN condition)
• Use parameters to allow concise
expression of examples
Guidelines
28
30. Okay Example:
GIVEN an active user with valid credentials and that user has previously
submitted a ticket
WHEN that user finds a previously submitted ticket in an active status
THEN that user has the option of sending a message
Better Example:
GIVEN I am an active user with valid credentials
AND I previously submitted a ticket
AND the ticket is in an active status
WHEN I find a previously submitted ticket
THEN I should see an option for sending a message
Exercise #1, Scenario 1
30
31. Okay Example:
GIVEN I am an unregistered user
WHEN I enter username “jsmith” and password “secret123!”
THEN I see a profile successfully created message on the Welcome page
Better Example:
GIVEN I am an unregistered user
WHEN I successfully create a user profile
THEN I see a profile successfully created message on the Welcome page
Exercise #1, Scenario 2
31
32. Okay Example:
GIVEN I add three items costing $5.25 each to my shopping cart
AND I am shipping to VA
WHEN I view my shopping cart
THEN I see an order total of $20.69
Better Example:
GIVEN I add these items to my shopping cart:
| item_id | quantity | price
| 10000 | 2 | $2.49
| 29901 | 1 | $11.98
AND I am shipping to “<state>”
WHEN I view my shopping cart
THEN I see an order total of “<order_total>”
Exercise #1, Scenario 3
32
34. Exercise #2
34
Product Name: CoffeeSpot
Mobile Application
Vision: The CoffeeSpot application allows customers to request
a spot to decrease wait time at a specified location. It allows
administrators to provide an alternate work location to the
remote workforce while minimizing unclaimed inventory.
Personas Big Picture Product Details
Joe Cupps
(Administrator)
Indicate
Available
Spots
Show
Available
Spots
Track Usage
Details
Claim Spot
View Usage
Details
Release
Spot
Lisa Java
(Customer)
36. ACCEPTANCE TESTS
End-to-end system tests
INTEGRATION TESTS
Tests that verify integrated
components or subsystems
UNIT TESTS
Tests that verify components in isolation
Test Pyramid
36
Exploratory
Testing
Adapted from: https://www.ibm.com/developerworks/library/j-aopwork11/
37. • Consistency makes it easier to automate
• BAs need to continue to own acceptance
tests
• Involve developers early
• Use a Gherkin editor
• Automate an end-to-end user journey
Tips for Automation
37
38. • Automated acceptance tests does not mean no
manual testing
• Business users find G-W-T difficult to
understand
• No all Product Owners see the value in
automation
• Factor in reduced team capacity due to
instrumenting the tests
• Automate by user journeys
• Provide BAs with a tool for maintaining
Lessons Learned
38
39. Books
• Gojko Adzic, Specification by Example: How Successful Teams
Deliver the Right Software
• Mario Cardinal, Executable Specifications with Scrum: A Practical
Guide to Agile Requirements Discovery
Blogs
• http://ebgconsulting.com/blog
• http://dannorth.net
• http://watirmelon.com/
• http://gojko.net/
Want to learn more?
39
40. Benefits of Failure:
http://www.ted.com/talks/tim_harford
Optimism Bias:
http://www.ted.com/talks/tali_sharot_the_optimism_bias
Gherkin Syntax:
http://docs.behat.org/guides/1.gherkin.html
http://www.concordion.org/Technique.html
Expert Panel:
http://www.infoq.com/articles/virtual-panel-bdd
More resources
40