Sheffield - Oct 2008




From Specification
to Success
Turning real user stories into
runnable, reliable code



     Creative Commons Attribution-Noncommercial-Share Alike
                                                                Ashley Moran
     2.0 UK: England & Wales License                          PatchSpace Ltd
Specification
Specification


We organise conferences
Specification


We organise conferences
  Such as BarCamp
Specification


We organise conferences
  Such as BarCamp
We need a website to organise and promote our
events
User Roles
User Roles
External roles in green, internal roles in orange
User Roles
External roles in green, internal roles in orange

Potential Delegate         Potential Sponsor
Confirmed Delegate          Confirmed Sponsor
Potential Speaker          Organiser
Confirmed Speaker           Steering Group Member
Potential Steward          Promoter
Steward
A User Story
A User Story
Story: Organiser confirms Proposed Talk
 So that Delegates and Speakers know what
          Talks are happening
 As an Organiser
 I want to confirm Proposed Talks
Acceptance criteria:
   Talk clearly viewable as confirmed by everyone
   Can choose which Room and Timeslot to book Talk
   against
   Can’t double-book a Room
Valuable Stories
Valuable Stories
 So that ...
 As a ...
 I want to ...
Valuable Stories
  So that ...
  As a ...
  I want to ...

 The So that line is the most important
Valuable Stories
  So that ...
  As a ...
  I want to ...

 The So that line is the most important
 You don’t do anything with a story
 until you’ve identified what makes it valuable
Valuable Stories
  So that ...
  As a ...
  I want to ...

 The So that line is the most important
 You don’t do anything with a story
 until you’ve identified what makes it valuable
 You don’t do anything at all
 until you have a valuable story
(Acceptance   Criteria)2
(Acceptance             Criteria)2


Do write criteria that can be easily verified by humans
(Acceptance             Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
(Acceptance             Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
Don’t be too prescriptive (eg define the user interface)
(Acceptance                 Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
Don’t be too prescriptive (eg define the user interface)
  Button ‘Confirm this talk’ next to each Talk on Talks admin page
(Acceptance                 Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
Don’t be too prescriptive (eg define the user interface)
  Button ‘Confirm this talk’ next to each Talk on Talks admin page

Don’t hide new stories in acceptance criteria
(Acceptance                 Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
Don’t be too prescriptive (eg define the user interface)
  Button ‘Confirm this talk’ next to each Talk on Talks admin page

Don’t hide new stories in acceptance criteria
  Organisers can search for unconfirmed talks
(Acceptance                 Criteria)2


Do write criteria that can be easily verified by humans
Do make them discrete (machines need to verify them)
Don’t be too prescriptive (eg define the user interface)
  Button ‘Confirm this talk’ next to each Talk on Talks admin page

Don’t hide new stories in acceptance criteria
  Organisers can search for unconfirmed talks

  Email notification of confirmation sent to Speaker
Your Task
Your Task

Put yourselves in the role on the role card
Your Task

Put yourselves in the role on the role card
Think what value you want from the software
Your Task

Put yourselves in the role on the role card
Think what value you want from the software
Working as a team, brainstorm stories (follow the
structure on the cards)
Your Task

Put yourselves in the role on the role card
Think what value you want from the software
Working as a team, brainstorm stories (follow the
structure on the cards)
Think about the relative value of each story as you write
them
Your Task

Put yourselves in the role on the role card
Think what value you want from the software
Working as a team, brainstorm stories (follow the
structure on the cards)
Think about the relative value of each story as you write
them
You’ve got 10 minutes!
Prioritising
Prioritising
 In groups
Prioritising
 In groups
   choose the single most valuable story from your
   stack
Prioritising
 In groups
   choose the single most valuable story from your
   stack
   nominate someone to represent your table
Prioritising
 In groups
   choose the single most valuable story from your
   stack
   nominate someone to represent your table
 Role representatives
Prioritising
 In groups
   choose the single most valuable story from your
   stack
   nominate someone to represent your table
 Role representatives
   stand up!
Prioritising
 In groups
   choose the single most valuable story from your
   stack
   nominate someone to represent your table
 Role representatives
   stand up!
   in turn, read the title and body of your story, skipping
   any acceptance criteria for now
Prioritising
Prioritising

 Remember
Prioritising

 Remember
  We need a website to organise and promote our
  events
Prioritising

 Remember
   We need a website to organise and promote our
   events
 Role representatives only:
Prioritising

 Remember
   We need a website to organise and promote our
   events
 Role representatives only:
   Identify between yourselves the most valuable story
   to our organisation
The Most Valuable Story
The Most Valuable Story
This was one of the stories written out on the night by a member
of the audience, and decided among them the most important
The Most Valuable Story
This was one of the stories written out on the night by a member
of the audience, and decided among them the most important
The Most Valuable Story
This was one of the stories written out on the night by a member
of the audience, and decided among them the most important




No prizes for noticing the spelling mistake :)
Interlude
Now to code
Success
Success
Discussion encouraged
Success
Discussion encouraged
  In reality, developers work with users to write stories
Success
Discussion encouraged
  In reality, developers work with users to write stories
Value delivered from the beginning
Success
Discussion encouraged
  In reality, developers work with users to write stories
Value delivered from the beginning
  Or at least after any bootstrapping work
Success
Discussion encouraged
  In reality, developers work with users to write stories
Value delivered from the beginning
  Or at least after any bootstrapping work
Functionality automatically verified against the users’
own acceptance criteria
Success
Discussion encouraged
  In reality, developers work with users to write stories
Value delivered from the beginning
  Or at least after any bootstrapping work
Functionality automatically verified against the users’
own acceptance criteria
Actual needs satisfied vs on time, on spec, on
budget... but off target
Success
Discussion encouraged
  In reality, developers work with users to write stories
Value delivered from the beginning
  Or at least after any bootstrapping work
Functionality automatically verified against the users’
own acceptance criteria
Actual needs satisfied vs on time, on spec, on
budget... but off target
Less waste means more value, more profit
Thanks for joining in
Thanks for joining in


 For slides, follow the blog link on
 www.patchspace.co.uk (tomorrow afternoon)
Thanks for joining in


 For slides, follow the blog link on
 www.patchspace.co.uk (tomorrow afternoon)
 Download slides contain a reference section
Thanks for joining in


 For slides, follow the blog link on
 www.patchspace.co.uk (tomorrow afternoon)
 Download slides contain a reference section
 Speak to me later if you’d like to know more
Thanks for joining in


 For slides, follow the blog link on
 www.patchspace.co.uk (tomorrow afternoon)
 Download slides contain a reference section
 Speak to me later if you’d like to know more
 Questions?
Reference
Some technical notes about
the technologies used
Tools: RSpec
Tools: RSpec


Behaviour-Driven Development equivalent to the xUnit
family of tools, written in Ruby
Tools: RSpec


Behaviour-Driven Development equivalent to the xUnit
family of tools, written in Ruby
Lets you write low-level specs for Ruby or Java code
(with JtestR)
Tools: RSpec


Behaviour-Driven Development equivalent to the xUnit
family of tools, written in Ruby
Lets you write low-level specs for Ruby or Java code
(with JtestR)
Not the focus of this presentation
Tools: Celerity
Tools: Celerity

 Celerity is a JRuby project that wraps the Java library
 HtmlUnit and Rhino
Tools: Celerity

 Celerity is a JRuby project that wraps the Java library
 HtmlUnit and Rhino
 HtmlUnit is a virtual browser, with HTTPS, cookie etc
 support, but no GUI dependencies
Tools: Celerity

 Celerity is a JRuby project that wraps the Java library
 HtmlUnit and Rhino
 HtmlUnit is a virtual browser, with HTTPS, cookie etc
 support, but no GUI dependencies
 Rhino is a Java implementation of JavaScript that
 HtmlUnit uses to drive dynamic web sites
Tools: Celerity

 Celerity is a JRuby project that wraps the Java library
 HtmlUnit and Rhino
 HtmlUnit is a virtual browser, with HTTPS, cookie etc
 support, but no GUI dependencies
 Rhino is a Java implementation of JavaScript that
 HtmlUnit uses to drive dynamic web sites
 Celerity exposes a Watir interface to HtmlUnit, and can
 be used in place of Watir or Selenium
Tools: RSpec Stories
Tools: RSpec Stories

Run plain-text story scenarios with no translation
Tools: RSpec Stories

Run plain-text story scenarios with no translation
Currently being re-implemented by Aslak Hellesøy
under the name Cucumber - this will be the default
implementation after RSpec 1.1.5
Tools: RSpec Stories

Run plain-text story scenarios with no translation
Currently being re-implemented by Aslak Hellesøy
under the name Cucumber - this will be the default
implementation after RSpec 1.1.5
Cucumber can run in JRuby with JTestR too
Tools: RSpec Stories

Run plain-text story scenarios with no translation
Currently being re-implemented by Aslak Hellesøy
under the name Cucumber - this will be the default
implementation after RSpec 1.1.5
Cucumber can run in JRuby with JTestR too
                   Cucumber + Celerity
                            =
  verify your real app directly against real user stories
Installation
Installation

 If you’re on a Mac with MacPorts:
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby

   root# jgem install celerity jruby-openssl hoe rspec
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby

   root# jgem install celerity jruby-openssl hoe rspec

 Currently (27-Sep-2008) the Cucumber gem on
 GitHub is broken, install from source:
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby

   root# jgem install celerity jruby-openssl hoe rspec

 Currently (27-Sep-2008) the Cucumber gem on
 GitHub is broken, install from source:
   you% git clone git://github.com/aslakhellesoy/cucumber.git
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby

   root# jgem install celerity jruby-openssl hoe rspec

 Currently (27-Sep-2008) the Cucumber gem on
 GitHub is broken, install from source:
   you% git clone git://github.com/aslakhellesoy/cucumber.git

   you% cd cucumber && rake gem
Installation

 If you’re on a Mac with MacPorts:
   root# port install jruby

   root# jgem install celerity jruby-openssl hoe rspec

 Currently (27-Sep-2008) the Cucumber gem on
 GitHub is broken, install from source:
   you% git clone git://github.com/aslakhellesoy/cucumber.git

   you% cd cucumber && rake gem

   root# jgem install pkg/cucumber-X.Y.Z.gem

From Specification To Success

  • 1.
    Sheffield - Oct2008 From Specification to Success Turning real user stories into runnable, reliable code Creative Commons Attribution-Noncommercial-Share Alike Ashley Moran 2.0 UK: England & Wales License PatchSpace Ltd
  • 2.
  • 3.
  • 4.
  • 5.
    Specification We organise conferences Such as BarCamp We need a website to organise and promote our events
  • 6.
  • 7.
    User Roles External rolesin green, internal roles in orange
  • 8.
    User Roles External rolesin green, internal roles in orange Potential Delegate Potential Sponsor Confirmed Delegate Confirmed Sponsor Potential Speaker Organiser Confirmed Speaker Steering Group Member Potential Steward Promoter Steward
  • 9.
  • 10.
    A User Story Story:Organiser confirms Proposed Talk So that Delegates and Speakers know what Talks are happening As an Organiser I want to confirm Proposed Talks Acceptance criteria: Talk clearly viewable as confirmed by everyone Can choose which Room and Timeslot to book Talk against Can’t double-book a Room
  • 11.
  • 12.
    Valuable Stories Sothat ... As a ... I want to ...
  • 13.
    Valuable Stories So that ... As a ... I want to ... The So that line is the most important
  • 14.
    Valuable Stories So that ... As a ... I want to ... The So that line is the most important You don’t do anything with a story until you’ve identified what makes it valuable
  • 15.
    Valuable Stories So that ... As a ... I want to ... The So that line is the most important You don’t do anything with a story until you’ve identified what makes it valuable You don’t do anything at all until you have a valuable story
  • 16.
    (Acceptance Criteria)2
  • 17.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans
  • 18.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them)
  • 19.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them) Don’t be too prescriptive (eg define the user interface)
  • 20.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them) Don’t be too prescriptive (eg define the user interface) Button ‘Confirm this talk’ next to each Talk on Talks admin page
  • 21.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them) Don’t be too prescriptive (eg define the user interface) Button ‘Confirm this talk’ next to each Talk on Talks admin page Don’t hide new stories in acceptance criteria
  • 22.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them) Don’t be too prescriptive (eg define the user interface) Button ‘Confirm this talk’ next to each Talk on Talks admin page Don’t hide new stories in acceptance criteria Organisers can search for unconfirmed talks
  • 23.
    (Acceptance Criteria)2 Do write criteria that can be easily verified by humans Do make them discrete (machines need to verify them) Don’t be too prescriptive (eg define the user interface) Button ‘Confirm this talk’ next to each Talk on Talks admin page Don’t hide new stories in acceptance criteria Organisers can search for unconfirmed talks Email notification of confirmation sent to Speaker
  • 24.
  • 25.
    Your Task Put yourselvesin the role on the role card
  • 26.
    Your Task Put yourselvesin the role on the role card Think what value you want from the software
  • 27.
    Your Task Put yourselvesin the role on the role card Think what value you want from the software Working as a team, brainstorm stories (follow the structure on the cards)
  • 28.
    Your Task Put yourselvesin the role on the role card Think what value you want from the software Working as a team, brainstorm stories (follow the structure on the cards) Think about the relative value of each story as you write them
  • 29.
    Your Task Put yourselvesin the role on the role card Think what value you want from the software Working as a team, brainstorm stories (follow the structure on the cards) Think about the relative value of each story as you write them You’ve got 10 minutes!
  • 30.
  • 31.
  • 32.
    Prioritising In groups choose the single most valuable story from your stack
  • 33.
    Prioritising In groups choose the single most valuable story from your stack nominate someone to represent your table
  • 34.
    Prioritising In groups choose the single most valuable story from your stack nominate someone to represent your table Role representatives
  • 35.
    Prioritising In groups choose the single most valuable story from your stack nominate someone to represent your table Role representatives stand up!
  • 36.
    Prioritising In groups choose the single most valuable story from your stack nominate someone to represent your table Role representatives stand up! in turn, read the title and body of your story, skipping any acceptance criteria for now
  • 37.
  • 38.
  • 39.
    Prioritising Remember We need a website to organise and promote our events
  • 40.
    Prioritising Remember We need a website to organise and promote our events Role representatives only:
  • 41.
    Prioritising Remember We need a website to organise and promote our events Role representatives only: Identify between yourselves the most valuable story to our organisation
  • 42.
  • 43.
    The Most ValuableStory This was one of the stories written out on the night by a member of the audience, and decided among them the most important
  • 44.
    The Most ValuableStory This was one of the stories written out on the night by a member of the audience, and decided among them the most important
  • 45.
    The Most ValuableStory This was one of the stories written out on the night by a member of the audience, and decided among them the most important No prizes for noticing the spelling mistake :)
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
    Success Discussion encouraged In reality, developers work with users to write stories
  • 51.
    Success Discussion encouraged In reality, developers work with users to write stories Value delivered from the beginning
  • 52.
    Success Discussion encouraged In reality, developers work with users to write stories Value delivered from the beginning Or at least after any bootstrapping work
  • 53.
    Success Discussion encouraged In reality, developers work with users to write stories Value delivered from the beginning Or at least after any bootstrapping work Functionality automatically verified against the users’ own acceptance criteria
  • 54.
    Success Discussion encouraged In reality, developers work with users to write stories Value delivered from the beginning Or at least after any bootstrapping work Functionality automatically verified against the users’ own acceptance criteria Actual needs satisfied vs on time, on spec, on budget... but off target
  • 55.
    Success Discussion encouraged In reality, developers work with users to write stories Value delivered from the beginning Or at least after any bootstrapping work Functionality automatically verified against the users’ own acceptance criteria Actual needs satisfied vs on time, on spec, on budget... but off target Less waste means more value, more profit
  • 56.
  • 57.
    Thanks for joiningin For slides, follow the blog link on www.patchspace.co.uk (tomorrow afternoon)
  • 58.
    Thanks for joiningin For slides, follow the blog link on www.patchspace.co.uk (tomorrow afternoon) Download slides contain a reference section
  • 59.
    Thanks for joiningin For slides, follow the blog link on www.patchspace.co.uk (tomorrow afternoon) Download slides contain a reference section Speak to me later if you’d like to know more
  • 60.
    Thanks for joiningin For slides, follow the blog link on www.patchspace.co.uk (tomorrow afternoon) Download slides contain a reference section Speak to me later if you’d like to know more Questions?
  • 61.
    Reference Some technical notesabout the technologies used
  • 62.
  • 63.
    Tools: RSpec Behaviour-Driven Developmentequivalent to the xUnit family of tools, written in Ruby
  • 64.
    Tools: RSpec Behaviour-Driven Developmentequivalent to the xUnit family of tools, written in Ruby Lets you write low-level specs for Ruby or Java code (with JtestR)
  • 65.
    Tools: RSpec Behaviour-Driven Developmentequivalent to the xUnit family of tools, written in Ruby Lets you write low-level specs for Ruby or Java code (with JtestR) Not the focus of this presentation
  • 66.
  • 67.
    Tools: Celerity Celerityis a JRuby project that wraps the Java library HtmlUnit and Rhino
  • 68.
    Tools: Celerity Celerityis a JRuby project that wraps the Java library HtmlUnit and Rhino HtmlUnit is a virtual browser, with HTTPS, cookie etc support, but no GUI dependencies
  • 69.
    Tools: Celerity Celerityis a JRuby project that wraps the Java library HtmlUnit and Rhino HtmlUnit is a virtual browser, with HTTPS, cookie etc support, but no GUI dependencies Rhino is a Java implementation of JavaScript that HtmlUnit uses to drive dynamic web sites
  • 70.
    Tools: Celerity Celerityis a JRuby project that wraps the Java library HtmlUnit and Rhino HtmlUnit is a virtual browser, with HTTPS, cookie etc support, but no GUI dependencies Rhino is a Java implementation of JavaScript that HtmlUnit uses to drive dynamic web sites Celerity exposes a Watir interface to HtmlUnit, and can be used in place of Watir or Selenium
  • 71.
  • 72.
    Tools: RSpec Stories Runplain-text story scenarios with no translation
  • 73.
    Tools: RSpec Stories Runplain-text story scenarios with no translation Currently being re-implemented by Aslak Hellesøy under the name Cucumber - this will be the default implementation after RSpec 1.1.5
  • 74.
    Tools: RSpec Stories Runplain-text story scenarios with no translation Currently being re-implemented by Aslak Hellesøy under the name Cucumber - this will be the default implementation after RSpec 1.1.5 Cucumber can run in JRuby with JTestR too
  • 75.
    Tools: RSpec Stories Runplain-text story scenarios with no translation Currently being re-implemented by Aslak Hellesøy under the name Cucumber - this will be the default implementation after RSpec 1.1.5 Cucumber can run in JRuby with JTestR too Cucumber + Celerity = verify your real app directly against real user stories
  • 76.
  • 77.
    Installation If you’reon a Mac with MacPorts:
  • 78.
    Installation If you’reon a Mac with MacPorts: root# port install jruby
  • 79.
    Installation If you’reon a Mac with MacPorts: root# port install jruby root# jgem install celerity jruby-openssl hoe rspec
  • 80.
    Installation If you’reon a Mac with MacPorts: root# port install jruby root# jgem install celerity jruby-openssl hoe rspec Currently (27-Sep-2008) the Cucumber gem on GitHub is broken, install from source:
  • 81.
    Installation If you’reon a Mac with MacPorts: root# port install jruby root# jgem install celerity jruby-openssl hoe rspec Currently (27-Sep-2008) the Cucumber gem on GitHub is broken, install from source: you% git clone git://github.com/aslakhellesoy/cucumber.git
  • 82.
    Installation If you’reon a Mac with MacPorts: root# port install jruby root# jgem install celerity jruby-openssl hoe rspec Currently (27-Sep-2008) the Cucumber gem on GitHub is broken, install from source: you% git clone git://github.com/aslakhellesoy/cucumber.git you% cd cucumber && rake gem
  • 83.
    Installation If you’reon a Mac with MacPorts: root# port install jruby root# jgem install celerity jruby-openssl hoe rspec Currently (27-Sep-2008) the Cucumber gem on GitHub is broken, install from source: you% git clone git://github.com/aslakhellesoy/cucumber.git you% cd cucumber && rake gem root# jgem install pkg/cucumber-X.Y.Z.gem