Readable, Executable Requirements: 
Hands-On 
Emily Bache, Bache Consulting & Pagero 
@esconfs 
#esconfs 
Insert speaker 
picture here, 
no more than 
150x150 
pixels
Agile Requirements 
User Story + Conversation + Example 
= Requirement 
From “Agile Testing” by Crispin, Gregory 
3
ATDD vs BDD vs Spec by Example? 
Where we choose to call it BDD or ATDD or 
Specification by Example, we want the same result 
– a shared common understanding of what is to 
be built to try to build the ‘thing’ right the first 
time. 
-- Janet Gregory 
http://janetgregory.blogspot.se/ 
2010/08/atdd-vs-bdd-vs-specification- 
by-example.html 4
Thought Leaders 
ATDD: 
◦ Janet Gregory, Lisa Crispin, Markus Gärtner 
Specification by Example: 
◦Gojko Adzic, David Evans 
BDD: 
◦ Liz Keogh, Dan North, Chris Matts 
5
TDD inner & outer loops 
Write a failing 
unit test 
make the 
test pass 
refactor 
from “Growing Object Oriented Software, 
Guided by Tests” by Freeman, Pryce 
Write a failing 
acceptance test 
6
TDD won’t help you if... 
 You don’t know what problem to solve 
Write a failing 
unit test 
make the 
test pass 
refactor 
7
TDD is less useful if... 
 you tend to have a lot of integration errors 
8 
Write a failing 
unit test 
make the 
test pass 
refactor
TDD inner & outer loops 
Write a failing 
unit test 
make the 
test pass 
refactor 
from “Growing Object Oriented Software, 
Guided by Tests” by Freeman, Pryce 
Write a failing 
acceptance test 
9 
Where does this come from?
Agile Requirements 
+ + 
User Story Conversation Example 
Requirement 
From “Agile Testing” by Crispin, Gregory 
= 
10 
Example => Acceptance Test
Features + User Stories 
Feature 
As a <stakeholder> 
I want <feature> 
So that <benefit> 
User Story: 
A slice through a feature that 
can be built in 1-2 days 
11 
Business Analyst
Agile Requirements 
+ + 
User Story Conversation Coaching Test 
Requirement 
From “Agile Testing” by Crispin, Gregory 
= 
12
Conversation: 
combine perspectives 
Developer 
Tester Business Analyst 
“The Three Amigos” 
+ other 
stakeholders 
13
A Feature has many 
Scenarios 
Scenario 
Given <assumption> 
When <event> 
Then <outcome> 
14 
Feature 
As a <stakeholder> 
I want <feature> 
So that <benefit> 
Scenario 
Given <assumption> 
When <event> 
Then <outcome>
Discovering Scenarios 
+ other 
stakeholders  Scenarios are concrete 
examples 
 discovered through 
conversation 
Developer 
Tester Business Analyst 
“The Three Amigos” 
15
Feature & Scenario 
Feature: Free Delivery 
As an online retailer 
I want to offer free delivery to customers who 
place larger orders 
So that customers spend more money on our 
site 
Scenario: Customer qualifies for Free Delivery 
Given my shopping basket contains 550:- of goods 
When I place an order 
Then I am offered free delivery 
16
Discover Scenarios 
in Conversation 
Feature: Free Delivery 
Scenario: Order is large enough 
Scenario: Order total is too low 
Scenario: VIP Customer 
Scenario: Customer chooses express delivery instead 
Scenario: Customer has bad payment history 
Scenario: Customer lives overseas
Table format 
As an online retailer 
I want to offer free delivery to customers who 
place larger orders 
So that customers spend more money on our site 
Order total Destination Free delivery? 
500:- Sweden yes 
499:- Sweden no 
500:- Norway yes 
500:- France no
Deliberate Discovery 
Developer 
Tester Business Analyst 
Bugs often come from missed scenarios 
19 
 Is there another context 
in which this event will 
create a different 
outcome? 
 Is this the only outcome 
that matters?
Agile Requirements 
+ + 
User Story Conversation Examples 
Requirement 
From “Agile Testing” by Crispin, Gregory 
= 
20
A comprehensive regression test 
suite? 
 Having the conversation 
is the most important 
thing 
 write down the scenarios 
you need to remember 
 automate the important 
ones 
Automation should 
make things easier to 
change, not harder! 
21 
Developer 
Tester Business Analyst
Write Code 
 Code & unit tests 
 Scenarios automated as 
functional tests 
Testers 
Collaborate 
Developers 
22
Scenario -> Regression test 
 BEFORE code is written, it’s a requirement 
specification 
 AFTER code is written it’s a regression test 
Important to preserve the language & format 
23 
Living Documentation
When the code “works” 
Developer 
+ other 
stakeholders 
Tester Business Analyst 
“The Three Amigos” 
 Close the feedback loop 
 Check scenarios, do manual 
testing 
 Continue to run automated 
regression tests 
24
Using Cucumber 
Feature 
http://cukes.info 
Step Definitions 
System Under Test (SUT)
Exercise: FizzBuzz 
 Press “Start” 
Note your animal 
26 
http://54.228.126.85/?id=A7F4BF65F2
FizzBuzz - solution 
 http://54.228.126.85/?id=CBF012F624 
27
Exercise: Gilded Rose 
 Existing System 
 Complicated existing Requirements 
 New Requirement
GildedRose - solution 
 http://54.228.126.85/?id=DC3E0B2C26 
29
Exercise: Gilded Rose 
 Press “Start” 
Note your animal 
30 
http://54.228.126.85/?id=BD2E43F85E

Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013

  • 1.
    Readable, Executable Requirements: Hands-On Emily Bache, Bache Consulting & Pagero @esconfs #esconfs Insert speaker picture here, no more than 150x150 pixels
  • 3.
    Agile Requirements UserStory + Conversation + Example = Requirement From “Agile Testing” by Crispin, Gregory 3
  • 4.
    ATDD vs BDDvs Spec by Example? Where we choose to call it BDD or ATDD or Specification by Example, we want the same result – a shared common understanding of what is to be built to try to build the ‘thing’ right the first time. -- Janet Gregory http://janetgregory.blogspot.se/ 2010/08/atdd-vs-bdd-vs-specification- by-example.html 4
  • 5.
    Thought Leaders ATDD: ◦ Janet Gregory, Lisa Crispin, Markus Gärtner Specification by Example: ◦Gojko Adzic, David Evans BDD: ◦ Liz Keogh, Dan North, Chris Matts 5
  • 6.
    TDD inner &outer loops Write a failing unit test make the test pass refactor from “Growing Object Oriented Software, Guided by Tests” by Freeman, Pryce Write a failing acceptance test 6
  • 7.
    TDD won’t helpyou if...  You don’t know what problem to solve Write a failing unit test make the test pass refactor 7
  • 8.
    TDD is lessuseful if...  you tend to have a lot of integration errors 8 Write a failing unit test make the test pass refactor
  • 9.
    TDD inner &outer loops Write a failing unit test make the test pass refactor from “Growing Object Oriented Software, Guided by Tests” by Freeman, Pryce Write a failing acceptance test 9 Where does this come from?
  • 10.
    Agile Requirements ++ User Story Conversation Example Requirement From “Agile Testing” by Crispin, Gregory = 10 Example => Acceptance Test
  • 11.
    Features + UserStories Feature As a <stakeholder> I want <feature> So that <benefit> User Story: A slice through a feature that can be built in 1-2 days 11 Business Analyst
  • 12.
    Agile Requirements ++ User Story Conversation Coaching Test Requirement From “Agile Testing” by Crispin, Gregory = 12
  • 13.
    Conversation: combine perspectives Developer Tester Business Analyst “The Three Amigos” + other stakeholders 13
  • 14.
    A Feature hasmany Scenarios Scenario Given <assumption> When <event> Then <outcome> 14 Feature As a <stakeholder> I want <feature> So that <benefit> Scenario Given <assumption> When <event> Then <outcome>
  • 15.
    Discovering Scenarios +other stakeholders  Scenarios are concrete examples  discovered through conversation Developer Tester Business Analyst “The Three Amigos” 15
  • 16.
    Feature & Scenario Feature: Free Delivery As an online retailer I want to offer free delivery to customers who place larger orders So that customers spend more money on our site Scenario: Customer qualifies for Free Delivery Given my shopping basket contains 550:- of goods When I place an order Then I am offered free delivery 16
  • 17.
    Discover Scenarios inConversation Feature: Free Delivery Scenario: Order is large enough Scenario: Order total is too low Scenario: VIP Customer Scenario: Customer chooses express delivery instead Scenario: Customer has bad payment history Scenario: Customer lives overseas
  • 18.
    Table format Asan online retailer I want to offer free delivery to customers who place larger orders So that customers spend more money on our site Order total Destination Free delivery? 500:- Sweden yes 499:- Sweden no 500:- Norway yes 500:- France no
  • 19.
    Deliberate Discovery Developer Tester Business Analyst Bugs often come from missed scenarios 19  Is there another context in which this event will create a different outcome?  Is this the only outcome that matters?
  • 20.
    Agile Requirements ++ User Story Conversation Examples Requirement From “Agile Testing” by Crispin, Gregory = 20
  • 21.
    A comprehensive regressiontest suite?  Having the conversation is the most important thing  write down the scenarios you need to remember  automate the important ones Automation should make things easier to change, not harder! 21 Developer Tester Business Analyst
  • 22.
    Write Code Code & unit tests  Scenarios automated as functional tests Testers Collaborate Developers 22
  • 23.
    Scenario -> Regressiontest  BEFORE code is written, it’s a requirement specification  AFTER code is written it’s a regression test Important to preserve the language & format 23 Living Documentation
  • 24.
    When the code“works” Developer + other stakeholders Tester Business Analyst “The Three Amigos”  Close the feedback loop  Check scenarios, do manual testing  Continue to run automated regression tests 24
  • 25.
    Using Cucumber Feature http://cukes.info Step Definitions System Under Test (SUT)
  • 26.
    Exercise: FizzBuzz Press “Start” Note your animal 26 http://54.228.126.85/?id=A7F4BF65F2
  • 27.
    FizzBuzz - solution  http://54.228.126.85/?id=CBF012F624 27
  • 28.
    Exercise: Gilded Rose  Existing System  Complicated existing Requirements  New Requirement
  • 29.
    GildedRose - solution  http://54.228.126.85/?id=DC3E0B2C26 29
  • 30.
    Exercise: Gilded Rose  Press “Start” Note your animal 30 http://54.228.126.85/?id=BD2E43F85E