SlideShare a Scribd company logo
Cucumber
collaboration   language
discussion      value
customers       acceptance


                             Joseph Wilk
Why are you here?
Why are you here?
In order ...
Why are you here?
In order ...
As a Underground attendee
Why are you here?
In order ...
As a Underground attendee
I want ...
Why are you here?
In order ...
As a Underground attendee
I want ...
                    I’ll show you a
                        good time
What’s your acceptance
       criteria?
Scenario: Ecstatic Underground attendees
 Given people turned up
 When Joseph talks
 Then everyone should learn something new
 And no-one should fall asleep
 And no cucumbers should be thrown
Pass
Fail
Pass
 Fail
How do you know
  your finished?
           You’ll know
            when I’m
             finished
Outside-in
    User
   Browser
Outside-in
    User
   Browser

   Views
Outside-in
     User
   Browser

    Views


  Controllers
   Models
“I believe that the hardest part of software projects, the
most common source of project failure, is
communication with the customers and users of
that software.

By providing a clear yet precise language to deal
with domains, a DSL can help improve this
communication.”

                                          Martin Fowler
def given_ruby_provides_a_great_dsl(*arg)
  developers.should be_happy
end

given_ruby_provides_a_great_dsl 'run away!'
def given_ruby_provides_a_great_dsl(*arg)
  developers.should be_happy
end

given_ruby_provides_a_great_dsl 'run away!'




                    Developer
Why do I
                          quote things?

                            Why can
Underscores!              I not use ‘ $




               Customer
Customer            Developer




           Tester
Customer            Developer




           Tester
Customer                    Developer



           Microsoft Word




                   Tester
Customer                 Developer



           Cucumber




                Tester
Customer                        Developer

           Plaintext     Ruby




                       Tester
For Cuke Sake Why?
• Token Conversation
• Acceptance Criteria
• Design
• Documentation
• Functional test
• Integration test
Cucumber Feature
             Feature: Be awesome          Not
               Narrative                executed
Example of
             Scenario: title
behaviour
                      which rocks
               Given <some context>
               And <yet more context>
               When <some action>
 Steps
               And <more actions>
               Then <some outcome>
               And <more outcomes>
Cucumber Feature
             Feature: Be awesome          Not
               Narrative                executed
Example of
             Scenario: title
behaviour
                      which rocks
               Given <some context>
               And <yet more context>
               When <some action>
 Steps
               And <more actions>
               Then <some outcome>
               And <more outcomes>
Plaintext




Ruby               Plaintext
       Plaintext


        Ruby
        Ruby
Plaintext

Step   Given a foaming cuke




              Ruby               Plaintext
                     Plaintext


                      Ruby
                      Ruby
Plaintext

  Step      Given a foaming cuke




                   Ruby               Plaintext
                          Plaintext
            Given /^a foaming (.*)$/i do |fruit|
  Step        fruit.should == 'cukes'
              #assert_equal(fruit, 'cukes')
definition   end

                           Ruby
                           Ruby
Plaintext

  Step      Given a foaming cuke




                                               regexp match
                   Ruby               Plaintext
                          Plaintext
            Given /^a foaming (.*)$/i do |fruit|
  Step        fruit.should == 'cukes'
              #assert_equal(fruit, 'cukes')
definition   end

                           Ruby
                           Ruby
Cucumber provides the
      venue

                       Sinatra




                        Rails
           Cuke4Duke
Cucumber Gateway?
                               World
                             domination?




                           Cucumber

    Java Virtual Machine




                                Clojure
Cucumber   English
Cucumber   English
огурец       Russian
concombre    French
             Japanese
Okurkový     Czech
Gurke        German
Cucumber     English
pepino       Spanish
cetriolo     Italian
agurk        Danish
‫ﺍﳋﻴﺎﺭ‬        Arabic
ketimun      Indonesian
‫מְלָפְפֹון‬   Hebrew
Cogombre     Catalan
CUCUMBR      LOLCats
Agurk        Norwegian
огурец       Russian                     Korean
concombre    French
                          gurka          Swedish
             Japanese
                          castravete     Romanian
Okurkový     Czech
                          ogórek         Polish
Gurke        German
Cucumber     English      Kurk           Estonian
pepino       Spanish      dưa chuột      Vietnamese
cetriolo     Italian      uhorka         Slovak
agurk        Danish       gurķis         Latvian
‫ﺍﳋﻴﺎﺭ‬        Arabic       Agurkas        Lithuanian
ketimun      Indonesian   Salátauborka   Hungarian
‫מְלָפְפֹון‬   Hebrew
                          Kurkku         Finnish
Cogombre     Catalan
                          Краставица     Bulgarian
CUCUMBR      LOLCats
Agurk        Norwegian    Pepino         Portuguese
# language: en-au
Crikey: Eating

  Mate: cucumbers
    Ya now how I have 3 cucumbers
    When I eat 2 cucumbers
    Ya gotta have 2 cucumbers in the belly
    N I have 1 cucumber left



YaNowHow /^I have (d+) cucumbers$/ do |n|
  @basket = Basket.new(n.to_i)
end

When /^I eat (d+) cucumbers$/ do |n|
  @belly = Belly.new
  @belly.eat(@basket.take(n.to_i))
end

YaGotta /^have (d+) cucumbers in the belly$/ do |n|
  @belly.cukes.should == n.to_i
end
How Cucumber
supports 28+ languages
How Cucumber
     supports 28+ languages


grammar Feature
  ...
end
How Cucumber
       supports 28+ languages


grammar Feature
  ...
end


compiled



       Ruby
How Cucumber
       supports 28+ languages


grammar Feature   grammar <%= keywords('grammar_name', true) %>
  ...               rule step_keyword
end                   (<%= keywords('given') %>) /
                      (<%= keywords('when') %>) /
                      (<%= keywords('then') %>) /
compiled
                      (<%= keywords('and') %>) /
                      (<%= keywords('but') %>)
                    end
       Ruby         ...
                  end
"en-lol":                          "en-au":
  name: LOLCAT                       name: Australian
  native: LOLCAT                     native: Australian
  encoding: UTF-8                    encoding: UTF-8
  feature: OH HAI                    feature: Crikey
  background: B4                     background: Background
  scenario: MISHUN                   scenario: Mate
  scenario_outline: MISHUN SRSLY     scenario_outline: Blokes
  examples: EXAMPLZ                  examples: Cobber
  given: I CAN HAZ                   given: Ya know how
  when: WEN                          when: When
  then: DEN                          then: Ya gotta
  and: AN                            and: N
  but: BUT                           but: Cept
  space_after_keyword: true          space_after_keyword: true
Webrat
 Love
visit home_path
click_link "Web"
fill_in "Email", :with => "Rat”
click_button "Love"
                                 Bansky
Once more
    unto the breach,
      dear friends
brace yourself
§
Feature Request
I want members to be able to
rent a movie with a priority
indicating how much they
want to see the film
Talk
                   to me




Token for Conversation
Story

Story: Film Member selects a movie to rent with priority
  As a Film member
  I want to add movies to my rental list with a priority
  So that ...
Story

Story: Film Member selects a movie to rent with priority
  As a Film member
  I want to add movies to my rental list with a priority
  So that ...




          Give me the movie
               NOW!
Feature Injection

Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Stock department
  Wants Film members to add movies to their rental list with
  a priority
Feature Injection
Value
        Feature: Film Member selects a movie to rent with priority
          In order to maximise allocation of films
          The Stock department
          Wants Film members to add movies to their rental list with
          a priority
Feature Injection
Value
        Feature: Film Member selects a movie to rent with priority
          In order to maximise allocation of films
          The Stock department
          Wants Film members to add movies to their rental list with
Role      a priority
Feature Injection
Value
        Feature: Film Member selects a movie to rent with priority
          In order to maximise allocation of films
          The Stock department
          Wants Film members to add movies to their rental list with
Role      a priority



                          Role
Feature Injection
Value
        Feature: Film Member selects a movie to rent with priority
          In order to maximise allocation of films
          The Stock department
          Wants Film members to add movies to their rental list with
Role      a priority



                          Role                                Feature
Are we


   Acceptance
                     done yet?




Definition of Done.
Scenarios
Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Stock department
  Wants Film members to add movies to their rental list with
  a priority

  Scenario: High priority
Scenarios
Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Stock department
  Wants Film members to add movies to their rental list with
  a priority

  Scenario: High priority
   Given I'm logged in
   And I am viewing the movie "Casshern"
   When I choose "High priority"
   And I press "Rent"
   Then I should see "My rental list"
   And I should see "Casshern" in my rental list
   And "Casshern" should be marked as "High priority"
http://iphonemockup.lkmc.ch
Cuking time

   About
cuking time!
High Res: http://www.screencast.com/t/HbvPTbGy

   Low Res: http://www.vimeo.com/5751831
Here’s one I Cuked
      earlier

 Tasty
High Res: http://www.screencast.com/t/2E4nfzXotZ

    Low Res: http://www.vimeo.com/5751873
Getting Customers
 using Cucumber
Getting Customers
 using Cucumber

           I don’t
            bite
The Art of
       War Plaintext
                   ,                                               ,
                  @"===,                                  ,_____cctI
                  "?AAAAAAAAAAAAAAAA,,,,,,,,,,,,,,,,,,,,,;LLLLLLLLLL
       ~",,,       1""""""""""""###OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
        '"EEEEE, !'"***"~~~~~~"OOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
           ,EEEEE)>"'''???????"WWW!MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
             "E.,)+="WWW~~~~~~#"OOO1OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
         ,~:#")LLL!"+++???????"$$$1==========##/
          &LLLLLLLLL;;;;;;;;;;;;,,,/
          1#LLLLLLLLLLLLLLLLLLLLLL!
        ,!###LLLLLL"'EEEE,'"LLLLL!
        !######LLL" "EEE" "LLLL"
       !#########L!    "EEJ. "LL!
      !##########1       "JJ*,l"
    !############"!         ,l"
    1##########" 1"~~,~~"
   !##########"
  !###########!
  !###########1
 !############!
 1#############
!"#############"
!##############!
1##########"'                               A magnum, By calendron
1#####"'
"""""
Don’t force
              Feature: Title
                In order to <value>
                As a <role>

 structure      I want <feature>
Avoid Noise!
               Given I am able to login
               Given I am able to login
Avoid       Given I login
                Given I authenticate

Inconsistency   Given I gain access
Given   I go to the login page


 Balance
              And I   fill in "username" with "cuke"
              And I   fill in "password" with "cuker"
              And I   click "login"

Abstraction   Given I'm logged in
Use Language
               Building blocks
Given /I’m logged in/ do
  User.create!(:user => 'josephwilk', :password => "pass")
  Given 'I fill in "password" with "josephwilk"'
  Given 'I fill in "password" with "pass"'
  Given 'I click "login"'
end
Email        Email-spec

Webpages     Webrat

Forms        Webrat




Java/Swing   Swinger
Gherkin Metrics?
             Lack of narrative
# language: en-au
Crikey: Eating

  Mate: cucumbers                            Number
    Ya now how I have 3 cucumbers
    When I eat 2 cucumbers                   of steps
    Ya gotta have 2 cucumbers in the belly
    N I have 1 cucumber left




Number of                   Semantically
noise words                similar words
Need for SPEED


Slick wheels!
Spork
require 'rubygems'
require 'spork'

# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"

Spork.prefork do
                                                   $ spork cuc
  # Load all the heavy stuff...
end

Spork.each_run do
                                               $ cucumber --drb ...
  # Load the stuff just for this run...

  Before do
    Pages.delete_all
  end
end
Scaling - TestJour

                        slaves


    master




             features


                                 Bonjour
Need for speed
 Webrat 0.8



Celerity                                   12




  Watir                                    12




Selenium                                    12.9


           0   3.75        7.5       11.25         15
                 start-up time (seconds)
Tagging
Eye   Head

         Teeth
        Foam
        Dribble
Tagging
Feature: Verify billing

 @javascript
 Scenario: Missing product description

  Scenario: Several products




 $ cucumber --tags ~@javascript

 $ cucumber --tags @javascript
Tag Hooks             Before(‘@teleport’) do
                        teleport.prepare
Attach code to tags   end
Focused Testing
                          @teleport
                          Feature: Invent teleportation


  Run just enough tests   @money
                          Feature: Make lots of money
Continuous Integration(WIP)
    Fail
  Work in    Pass
             Done
  Pending
  progress

    add       list    $ cucumber --wip
   movies    movies
                                 --tags @WIP
                                 features/
    edit
   movies


   delete
   movies
Limiting Tags in Flow
   Work in
                    Done
   progress

 add add add add
movies movies
   movies movies           $ cucumber --tags @WIP:3
                                      features/
 add add add edit
movies movies
   movies movies                              limit 3 tags


 add add add
           delete
movies movies
   movies movies
Avoiding Unrealistic expectations
Further reading

•   http://cukes.info

•   http://wiki.github.com/
    aslakhellesoy/cucumber

•   http://blog.josephwilk.net
Thanks,
                           Call me
                          sometime



                      joe@josephwilk.net
             http://github.com/josephwilk
http://github.com/aslakhellesoy/cucumber

More Related Content

PDF
Outside-in Development with Cucumber and Rspec
PDF
Writing Software not Code with Cucumber
PDF
Behavior Driven Development - How To Start with Behat
PDF
RSpec User Stories
KEY
Writing your Third Plugin
PDF
Jumping Into WordPress Plugin Programming
PDF
An easy guide to Plugin Development
ODP
Outside-in Development with Cucumber and Rspec
Writing Software not Code with Cucumber
Behavior Driven Development - How To Start with Behat
RSpec User Stories
Writing your Third Plugin
Jumping Into WordPress Plugin Programming
An easy guide to Plugin Development

What's hot (19)

PDF
Hybrid Web Applications
PDF
RSpec 2 Best practices
KEY
BDD with Behat and Symfony2
PDF
Selenium Sandwich Part 1: Data driven Selenium
KEY
You're Doing It Wrong
DOCX
Cucumber testing
KEY
Copycopter Presentation by Joe Ferris at BostonRB
PDF
Selenium sandwich-2
PPTX
Behat - Drupal South 2018
PDF
"Managing API Complexity". Matthew Flaming, Temboo
PDF
Behaviour driven infrastructure
PPTX
5 Reasons To Love CodeIgniter
PPTX
I Love codeigniter, You?
PDF
Testing web APIs
PDF
So, you want to be a plugin developer?
PPT
What you can do In WatiR
PDF
Qpsmtpd
PDF
Drupal8 Front-end Automated Testing
PPT
Code smells in PHP
Hybrid Web Applications
RSpec 2 Best practices
BDD with Behat and Symfony2
Selenium Sandwich Part 1: Data driven Selenium
You're Doing It Wrong
Cucumber testing
Copycopter Presentation by Joe Ferris at BostonRB
Selenium sandwich-2
Behat - Drupal South 2018
"Managing API Complexity". Matthew Flaming, Temboo
Behaviour driven infrastructure
5 Reasons To Love CodeIgniter
I Love codeigniter, You?
Testing web APIs
So, you want to be a plugin developer?
What you can do In WatiR
Qpsmtpd
Drupal8 Front-end Automated Testing
Code smells in PHP
Ad

Similar to Cucumber Ru09 Web (20)

PDF
Cucumbered
PDF
Cucumber: 小黃瓜驗收測試工具
PDF
Spa2011
PDF
Rocket Fuelled Cucumbers
PDF
Behavior driven development with calabash for android
PPSX
Behaviour driven development present
PDF
CoffeeScript-Ruby-Tuesday
ZIP
Ruby Kaigi 2008 LT
PDF
Testing with Docker
PPTX
Ruby for PHP developers
PDF
Cucumber & BDD
PDF
Javascriptbootcamp
PPTX
Ruby for .NET developers
PDF
Smalltalk on rubinius
PPTX
Cucumber
PPTX
Ruby Programming Language - Introduction
PDF
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
DOCX
Cucumber testing
PDF
Happy Programming with CoffeeScript
PDF
Testing outside of the Ruby World
Cucumbered
Cucumber: 小黃瓜驗收測試工具
Spa2011
Rocket Fuelled Cucumbers
Behavior driven development with calabash for android
Behaviour driven development present
CoffeeScript-Ruby-Tuesday
Ruby Kaigi 2008 LT
Testing with Docker
Ruby for PHP developers
Cucumber & BDD
Javascriptbootcamp
Ruby for .NET developers
Smalltalk on rubinius
Cucumber
Ruby Programming Language - Introduction
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
Cucumber testing
Happy Programming with CoffeeScript
Testing outside of the Ruby World
Ad

More from Joseph Wilk (11)

PDF
Frozenrails2011
PDF
Acceptance testing in the land of the startup
PDF
Rubykaigi 2011 Limited Red talk
PDF
The Limited Red Society
PDF
The Limited Red Society
PDF
Rubyconf lightning talk
PDF
Acceptance testing in the land of the startup
PDF
Cucumber Patterns Workshop
KEY
Musichackday
PPT
Dynamic Workflow Pulling the Strings
PDF
Testing with Ruby
Frozenrails2011
Acceptance testing in the land of the startup
Rubykaigi 2011 Limited Red talk
The Limited Red Society
The Limited Red Society
Rubyconf lightning talk
Acceptance testing in the land of the startup
Cucumber Patterns Workshop
Musichackday
Dynamic Workflow Pulling the Strings
Testing with Ruby

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx

Cucumber Ru09 Web

  • 1. Cucumber collaboration language discussion value customers acceptance Joseph Wilk
  • 2. Why are you here?
  • 3. Why are you here? In order ...
  • 4. Why are you here? In order ... As a Underground attendee
  • 5. Why are you here? In order ... As a Underground attendee I want ...
  • 6. Why are you here? In order ... As a Underground attendee I want ... I’ll show you a good time
  • 8. Scenario: Ecstatic Underground attendees Given people turned up When Joseph talks Then everyone should learn something new And no-one should fall asleep And no cucumbers should be thrown
  • 11. How do you know your finished? You’ll know when I’m finished
  • 12. Outside-in User Browser
  • 13. Outside-in User Browser Views
  • 14. Outside-in User Browser Views Controllers Models
  • 15. “I believe that the hardest part of software projects, the most common source of project failure, is communication with the customers and users of that software. By providing a clear yet precise language to deal with domains, a DSL can help improve this communication.” Martin Fowler
  • 16. def given_ruby_provides_a_great_dsl(*arg) developers.should be_happy end given_ruby_provides_a_great_dsl 'run away!'
  • 17. def given_ruby_provides_a_great_dsl(*arg) developers.should be_happy end given_ruby_provides_a_great_dsl 'run away!' Developer
  • 18. Why do I quote things? Why can Underscores! I not use ‘ $ Customer
  • 19. Customer Developer Tester
  • 20. Customer Developer Tester
  • 21. Customer Developer Microsoft Word Tester
  • 22. Customer Developer Cucumber Tester
  • 23. Customer Developer Plaintext Ruby Tester
  • 24. For Cuke Sake Why? • Token Conversation • Acceptance Criteria • Design • Documentation • Functional test • Integration test
  • 25. Cucumber Feature Feature: Be awesome Not Narrative executed Example of Scenario: title behaviour which rocks Given <some context> And <yet more context> When <some action> Steps And <more actions> Then <some outcome> And <more outcomes>
  • 26. Cucumber Feature Feature: Be awesome Not Narrative executed Example of Scenario: title behaviour which rocks Given <some context> And <yet more context> When <some action> Steps And <more actions> Then <some outcome> And <more outcomes>
  • 27. Plaintext Ruby Plaintext Plaintext Ruby Ruby
  • 28. Plaintext Step Given a foaming cuke Ruby Plaintext Plaintext Ruby Ruby
  • 29. Plaintext Step Given a foaming cuke Ruby Plaintext Plaintext Given /^a foaming (.*)$/i do |fruit| Step fruit.should == 'cukes' #assert_equal(fruit, 'cukes') definition end Ruby Ruby
  • 30. Plaintext Step Given a foaming cuke regexp match Ruby Plaintext Plaintext Given /^a foaming (.*)$/i do |fruit| Step fruit.should == 'cukes' #assert_equal(fruit, 'cukes') definition end Ruby Ruby
  • 31. Cucumber provides the venue Sinatra Rails Cuke4Duke
  • 32. Cucumber Gateway? World domination? Cucumber Java Virtual Machine Clojure
  • 33. Cucumber English
  • 34. Cucumber English
  • 35. огурец Russian concombre French Japanese Okurkový Czech Gurke German Cucumber English pepino Spanish cetriolo Italian agurk Danish ‫ﺍﳋﻴﺎﺭ‬ Arabic ketimun Indonesian ‫מְלָפְפֹון‬ Hebrew Cogombre Catalan CUCUMBR LOLCats Agurk Norwegian
  • 36. огурец Russian Korean concombre French gurka Swedish Japanese castravete Romanian Okurkový Czech ogórek Polish Gurke German Cucumber English Kurk Estonian pepino Spanish dưa chuột Vietnamese cetriolo Italian uhorka Slovak agurk Danish gurķis Latvian ‫ﺍﳋﻴﺎﺭ‬ Arabic Agurkas Lithuanian ketimun Indonesian Salátauborka Hungarian ‫מְלָפְפֹון‬ Hebrew Kurkku Finnish Cogombre Catalan Краставица Bulgarian CUCUMBR LOLCats Agurk Norwegian Pepino Portuguese
  • 37. # language: en-au Crikey: Eating Mate: cucumbers Ya now how I have 3 cucumbers When I eat 2 cucumbers Ya gotta have 2 cucumbers in the belly N I have 1 cucumber left YaNowHow /^I have (d+) cucumbers$/ do |n| @basket = Basket.new(n.to_i) end When /^I eat (d+) cucumbers$/ do |n| @belly = Belly.new @belly.eat(@basket.take(n.to_i)) end YaGotta /^have (d+) cucumbers in the belly$/ do |n| @belly.cukes.should == n.to_i end
  • 39. How Cucumber supports 28+ languages grammar Feature ... end
  • 40. How Cucumber supports 28+ languages grammar Feature ... end compiled Ruby
  • 41. How Cucumber supports 28+ languages grammar Feature grammar <%= keywords('grammar_name', true) %> ... rule step_keyword end (<%= keywords('given') %>) / (<%= keywords('when') %>) / (<%= keywords('then') %>) / compiled (<%= keywords('and') %>) / (<%= keywords('but') %>) end Ruby ... end
  • 42. "en-lol": "en-au": name: LOLCAT name: Australian native: LOLCAT native: Australian encoding: UTF-8 encoding: UTF-8 feature: OH HAI feature: Crikey background: B4 background: Background scenario: MISHUN scenario: Mate scenario_outline: MISHUN SRSLY scenario_outline: Blokes examples: EXAMPLZ examples: Cobber given: I CAN HAZ given: Ya know how when: WEN when: When then: DEN then: Ya gotta and: AN and: N but: BUT but: Cept space_after_keyword: true space_after_keyword: true
  • 43. Webrat Love visit home_path click_link "Web" fill_in "Email", :with => "Rat” click_button "Love" Bansky
  • 44. Once more unto the breach, dear friends brace yourself
  • 45. §
  • 46. Feature Request I want members to be able to rent a movie with a priority indicating how much they want to see the film
  • 47. Talk to me Token for Conversation
  • 48. Story Story: Film Member selects a movie to rent with priority As a Film member I want to add movies to my rental list with a priority So that ...
  • 49. Story Story: Film Member selects a movie to rent with priority As a Film member I want to add movies to my rental list with a priority So that ... Give me the movie NOW!
  • 50. Feature Injection Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with a priority
  • 51. Feature Injection Value Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with a priority
  • 52. Feature Injection Value Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with Role a priority
  • 53. Feature Injection Value Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with Role a priority Role
  • 54. Feature Injection Value Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with Role a priority Role Feature
  • 55. Are we Acceptance done yet? Definition of Done.
  • 56. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with a priority Scenario: High priority
  • 57. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Stock department Wants Film members to add movies to their rental list with a priority Scenario: High priority Given I'm logged in And I am viewing the movie "Casshern" When I choose "High priority" And I press "Rent" Then I should see "My rental list" And I should see "Casshern" in my rental list And "Casshern" should be marked as "High priority"
  • 59. Cuking time About cuking time!
  • 60. High Res: http://www.screencast.com/t/HbvPTbGy Low Res: http://www.vimeo.com/5751831
  • 61. Here’s one I Cuked earlier Tasty
  • 62. High Res: http://www.screencast.com/t/2E4nfzXotZ Low Res: http://www.vimeo.com/5751873
  • 64. Getting Customers using Cucumber I don’t bite
  • 65. The Art of War Plaintext , , @"===, ,_____cctI "?AAAAAAAAAAAAAAAA,,,,,,,,,,,,,,,,,,,,,;LLLLLLLLLL ~",,, 1""""""""""""###OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO '"EEEEE, !'"***"~~~~~~"OOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ,EEEEE)>"'''???????"WWW!MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM "E.,)+="WWW~~~~~~#"OOO1OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ,~:#")LLL!"+++???????"$$$1==========##/ &LLLLLLLLL;;;;;;;;;;;;,,,/ 1#LLLLLLLLLLLLLLLLLLLLLL! ,!###LLLLLL"'EEEE,'"LLLLL! !######LLL" "EEE" "LLLL" !#########L! "EEJ. "LL! !##########1 "JJ*,l" !############"! ,l" 1##########" 1"~~,~~" !##########" !###########! !###########1 !############! 1############# !"#############" !##############! 1##########"' A magnum, By calendron 1#####"' """""
  • 66. Don’t force Feature: Title In order to <value> As a <role> structure I want <feature>
  • 67. Avoid Noise! Given I am able to login Given I am able to login
  • 68. Avoid Given I login Given I authenticate Inconsistency Given I gain access
  • 69. Given I go to the login page Balance And I fill in "username" with "cuke" And I fill in "password" with "cuker" And I click "login" Abstraction Given I'm logged in
  • 70. Use Language Building blocks Given /I’m logged in/ do User.create!(:user => 'josephwilk', :password => "pass") Given 'I fill in "password" with "josephwilk"' Given 'I fill in "password" with "pass"' Given 'I click "login"' end
  • 71. Email Email-spec Webpages Webrat Forms Webrat Java/Swing Swinger
  • 72. Gherkin Metrics? Lack of narrative # language: en-au Crikey: Eating Mate: cucumbers Number Ya now how I have 3 cucumbers When I eat 2 cucumbers of steps Ya gotta have 2 cucumbers in the belly N I have 1 cucumber left Number of Semantically noise words similar words
  • 74. Spork require 'rubygems' require 'spork' # Sets up the Rails environment for Cucumber ENV["RAILS_ENV"] ||= "cucumber" Spork.prefork do $ spork cuc # Load all the heavy stuff... end Spork.each_run do $ cucumber --drb ... # Load the stuff just for this run... Before do Pages.delete_all end end
  • 75. Scaling - TestJour slaves master features Bonjour
  • 76. Need for speed Webrat 0.8 Celerity 12 Watir 12 Selenium 12.9 0 3.75 7.5 11.25 15 start-up time (seconds)
  • 77. Tagging Eye Head Teeth Foam Dribble
  • 78. Tagging Feature: Verify billing @javascript Scenario: Missing product description Scenario: Several products $ cucumber --tags ~@javascript $ cucumber --tags @javascript
  • 79. Tag Hooks Before(‘@teleport’) do teleport.prepare Attach code to tags end
  • 80. Focused Testing @teleport Feature: Invent teleportation Run just enough tests @money Feature: Make lots of money
  • 81. Continuous Integration(WIP) Fail Work in Pass Done Pending progress add list $ cucumber --wip movies movies --tags @WIP features/ edit movies delete movies
  • 82. Limiting Tags in Flow Work in Done progress add add add add movies movies movies movies $ cucumber --tags @WIP:3 features/ add add add edit movies movies movies movies limit 3 tags add add add delete movies movies movies movies
  • 84. Further reading • http://cukes.info • http://wiki.github.com/ aslakhellesoy/cucumber • http://blog.josephwilk.net
  • 85. Thanks, Call me sometime joe@josephwilk.net http://github.com/josephwilk http://github.com/aslakhellesoy/cucumber