SlideShare une entreprise Scribd logo
1  sur  86
utside
in


     Development
     Cucumber                    Rspec
       Joseph Wilk / http://blog.josephwilk.net
Why are you here?
Why are you here?
In order to ...
Why are you here?
In order to ...
As a Scotland on Rails attendee
Why are you here?
In order to ...
As a Scotland on Rails attendee
I want ...
What is your
Acceptance Criteria?
Scenario: Happy SoR attendees
 Given people turned up
 When Joseph talks
 Then everyone should acquire some new knowledge
 And no-one should fall asleep
 And no rotten food should be thrown
Pass
 Fail
Outside-in
     User
   Browser
    Views

  Controllers
    Models
Cucumber
“The feature
you wished you
had”               Views

                 Controllers
                                  Rspec
                   Models           “The
                               components
                                  and the
                               interactions
                                you wish you
                                    had”
Cucumber
“The feature
you wished you
had”               Views

                 Controllers
                                  Rspec
                   Models           “The
                               components
                                  and the
                               interactions
                                you wish you
                                    had”
Cucumber
“The feature
you wished you
had”               Views

                 Controllers
                                  Rspec
                   Models           “The
                               components
                                  and the
                               interactions
                                you wish you
                                    had”
Cucumber / Scenario
Cucumber / Scenario
Cucumber / Scenario




                      Rspec / code
                       examples
Cucumber / Scenario




                      Rspec / code
                       examples
Cucumber / Scenario




                      Rspec / code
                       examples
Cucumber / Scenario




                      Rspec / code
                       examples
Cucumber / Scenario




                      Rspec / code
                       examples
:rspec => route finder
 :cucumber => destination


London               Edinburgh
Behaviour Driven Development
with elegance and joy
Behaviour Driven Development
with elegance and joy
                               Just Cuke it!
Plaintext        Ruby
Features    step definitions
Cucumber Feature
                             Not
                           executed
Feature: Be awesome
 Narrative
Scenario: title            Example of
  Given <some context>      behaviour
  And <yet more context>
  When <some action>
  And <more actions>
  Then <some outcome>
  And <more outcomes>
regexp match
  Step
definition
             Given /^we like (.*)$/i do |fruit|
               fruit.should == 'cukes'
Ruby tests     #assert_equal(fruit, 'cukes')
             end




 Plaintext   Given we like cukes



Feature


                      Cucumber
Plug and Pray
                                                  Rspec
          Plaintext              Ruby tests
                                                 TestUnit

                      Cucumber
Ruby-Gnome2                                   Cucumber


                            Sinatra
  Rails        Merb                            iPhone
Cucumber English
огурец    Russian               Chinese
concombre French                Korean
                       gurka    Swedish
          Japanese
          German       castravete Romanian
Gurke
                       ogórek
Cucumber English                 Polish
pepino   Spanish
         Italian
cetriolo
          Danish
agurk
‫ﺍﳋﻴﺎﺭ‬     Arabic
          Indonisean
ketimun
огурец    Russian               Chinese
concombre French                Korean
                       gurka    Swedish
          Japanese
          German       castravete Romanian
Gurke
                       ogórek
Cucumber English                 Polish
pepino   Spanish
                       Treetop Rocks
         Italian
cetriolo
                           ANTLR
          Danish
agurk
                          could rock
‫ﺍﳋﻴﺎﺭ‬     Arabic
          Indonisean
                            harder
ketimun
Webrat
 Love
visit home_path
click_link quot;Webquot;
fill_in quot;Emailquot;, :with => quot;Rat”
click_button quot;Lovequot;
                                 Bansky
Return On Investment
 Cucumber Feature
Return On Investment
 Cucumber Feature
     • Token Conversation
Return On Investment
 Cucumber Feature
     • Token Conversation
     • Acceptance Criteria
Return On Investment
 Cucumber Feature
     • Token Conversation
     • Acceptance Criteria
     • Design
Return On Investment
 Cucumber Feature
     • Token Conversation
     • Acceptance Criteria
     • Design
     • Documentation
Return On Investment
 Cucumber Feature
     • Token Conversation
     • Acceptance Criteria
     • Design
     • Documentation
     • Functional test
Return On Investment
 Cucumber Feature
     • Token Conversation
     • Acceptance Criteria
     • Design
     • Documentation
     • Functional test
     • Integration test
Token for Conversation
Outside-in Development with Cucumber and Rspec
Feature Request
I want members to be able to
rent a movie with a priority
indicating how much they
want to see the film
Show me the _ _ _ _ _
Show me the VA L U _
            ____E
Root Cause Analysis
Root Cause Analysis




Why?     So we can maximise allocation of
         films
Root Cause Analysis


Why?     Keep customers happy


Why?     So we can maximise allocation of
         films
Root Cause Analysis

Why?     So they continue with their
         subscriptions


Why?     Keep customers happy


Why?     So we can maximise allocation of
         films
Root Cause Analysis

Why?     So they continue with their
         subscriptions


Why?     Keep customers happy


Why?     So we can maximise allocation of
         films
Lets write our
Cucumber feature
Feature (terrible)
                                                            Value

  Feature: select a movie to rent with priority
    In order to maximise allocation of films
    The website user
    Needs to be able to add movies to their rental list with a priority




Role                                                    Feature
Feature (terrible)
                                                            Value

  Feature: select a movie to rent with priority
    In order to maximise allocation of films
                              Narrative
    The website user
    Needs to be able to add movies to their rental list with a priority




Role                                                    Feature
Feature (terrible)
                                                            Value

  Feature: select a movie to rent with priority
    In order to maximise allocation of films
    The website user
    Needs to be able to add movies to their rental list with a priority




Role                                                    Feature
Feature (terrible)

Feature: select a movie to rent with priority
  In order to maximise allocation of films
  The website user
  Needs to be able to add movies to their rental list with a priority
Feature (terrible)

Feature: select a movie to rent with priority
  In order to maximise allocation of films
  The website user
  Needs to be able to add movies to their rental list with a priority




       Noise
Feature (terrible)

 Feature: select a movie to rent with priority
   In order to maximise allocation of films
   The website user
   Needs to be able to add movies to their rental list with a priority




Too generic
   role
Feature (terrible)

 Feature: select a movie to rent with priority
   In order to maximise allocation of films
   The website user Film member
   Needs to be able to add movies to their rental list with a priority




Too generic
   role
Feature (terrible)
                                                Role can change
                                                    feature
Feature: select a movie to rent with priority
  In order to maximise allocation of films
  The website user Film member
  Needs to be able to add movies to their rental list with a priority
Feature (terrible)
                                                Role can change
                                                    feature
         Film Member selects a movie to rent with priority
Feature: select a movie to rent with priority
  In order to maximise allocation of films
  The website user Film member
  Needs to be able to add movies to their rental list with a priority
Nice
            Feature (terrible)

         Film Member selects a movie to rent with priority
Feature: select a movie to rent with priority
  In order to maximise allocation of films
  The website user Film member
  Needs to be able to add movies to their rental list with a priority
Acceptance
Definition of Done.
Scenarios
Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Film member
  Needs 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 Film member
  Needs to add movies to their rental list with a priority

  Scenario: High priority




   Then I should see quot;My rental listquot;
   And I should see quot;Casshernquot; in my rental list
   And quot;Casshernquot; should be marked as quot;High priorityquot;
Scenarios
Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Film member
  Needs to add movies to their rental list with a priority

  Scenario: High priority



   When I choose quot;High priorityquot;
   And I press quot;Rentquot;
   Then I should see quot;My rental listquot;
   And I should see quot;Casshernquot; in my rental list
   And quot;Casshernquot; should be marked as quot;High priorityquot;
Scenarios
Feature: Film Member selects a movie to rent with priority
  In order to maximise allocation of films
  The Film member
  Needs to add movies to their rental list with a priority

  Scenario: High priority
    Given I'm logged in
    And I am viewing the movie quot;Casshernquot;
    When I choose quot;High priorityquot;
    And I press quot;Rentquot;
    Then I should see quot;My rental listquot;
    And I should see quot;Casshernquot; in my rental list
    And quot;Casshernquot; should be marked as quot;High priorityquot;
Outside-in Development with Cucumber and Rspec
Let there be Cuking
Demo

             High Resolution:
http://www.screencast.com/t/aG1sE4N3Zq

            Low Resolution:
    http://www.vimeo.com/3910617
Here’s one I
Cuked earlier
Demo

          High Resolution:
http://www.screencast.com/t/tlBYxkKci

           Low Resolution
   http://www.vimeo.com/3911104
Installing Cucumber

$ sudo gem install cucumber

$ script/plugin install git://github.com/aslakhellesoy/
cucumber.git



$ gem sources -a http://gems.github.com

$ sudo gem install aslakhellesoy-cucumber
Fixtures
Scenario: search results found   Given /^the Movies$/i do |movie_hash|
  Given the Movies                 #{:title => quot;The colour whitequot;},
    |     title        |           #{:title => quot;The colour redquot;},
    | The colour white |           #{:title => quot;Casshernquot;}
    | The colour red   |           movies.hashes.each do |values|
    | Casshern         |             Movie.create!(values)
  When I search for quot;colourquot;       end
  Then I will see 2 results      end



           Scenario: search results found
             Given 2 films with quot;colourquot; in the title
             When I search for quot;colourquot;
             Then I will see 2 results
Stick it to the World
module NavigationHelpers
  def path_to(page_name)
    case page_name
    when /the homepage/
      root_path
    else
      raise quot;Can't find mapping from quot;#{page_name}quot; to a path.quot;
    end
  end
end

World do |world|
  world.extend NavigationHelpers
  world
end
Hooks
  Hooks are GLOBAL!

Before do
  # do something before each scenario.
end

After do
  #do something after each scenario
end
How many scenarios is
     enough?
• Given/When/Then
      “Finite state machine” Uncle Bob


• What’s the Return on Investment?
Cowcumbers (Bad smells)
    “fit only for consumption by cows”
Cowcumbers
                              Given /^dirty state$/ do
                                @movie = Movie.create!

Relying on state (too much)   end
                              Given /^coupled by state$/ do
                                @movie.title = quot;yuckyquot;
                              end




                              Given /^does a user care$/ do
                                response.current_url == ‘silly’
                              end
Tests without user value      Given /^checking the db$/ do
                                Movie.find(1).should_not == nil
                              end
Building your DSL
Concrete vs Abstract
                Scenarios
                                           Given I'm logged in
Given   I go to the login page
And I   fill in quot;usernamequot; with quot;josephquot;
And I   fill in quot;passwordquot; with quot;cukerquot;
And I   click quot;loginquot;




                         Domain understanding

         Concrete                                          Abstract
Calling steps from steps

Given /I’m logged in/ do
  User.create!(:user => 'josephwilk', :password => quot;passquot;)
  Given 'I fill in quot;passwordquot; with quot;josephwilkquot;'
  Given 'I fill in quot;passwordquot; with quot;passquot;'
  Given 'I click quot;loginquot;'
end
Feature Request

Can you add some of that
funky AJAX stuff for the
rent button
JavaScript kills Webrat
Watir, Selenium &
            Celerity
    Browser based       Headless Browser

•                   •
    Watir               Celerity

•                   •
    Selenium            Culerity - http://
                        github.com/langalex/
                        culerity/tree/master
Webrat / Selenium
   # Sets up the Rails environment for Cucumber
ENV[quot;RAILS_ENVquot;] ||= quot;seleniumquot;
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatters/unicode'
                                                         Turn off
#Cucumber::Rails.use_transactional_fixtures
require 'webrat'

Webrat.configure do |config|

                                         Switch to Selenium
  config.mode = :selenium
end
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'

Before do
  Movie.delete_all
                                           Manually cleanup
  RentalRequest.delete_all
end
Organising
      @in-progress
      Feature: Verify billing


Tag    @js
       Scenario: Missing product description

        Scenario: Several products




      cucumber --profile rails --tags ~@js

      cucumber --profile browser --tags @js
Demo

             High Resolution:
http://www.screencast.com/t/1jRSI6TvXWu

             Low Resolution:
     http://www.vimeo.com/3911241
Further reading

•   http://cukes.info

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

•   http://rspec.info/

•   http://blog.josephwilk.net
Thanks
    joe@josephwilk.net
http://github.com/josephwilk

Contenu connexe

Tendances

Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingDougal Campbell
 
Implementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using CucumberImplementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using CucumberTechWell
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin DevelopmentShinichi Nishikawa
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniternicdev
 
Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web ApplicationsJames Da Costa
 
BDD with Behat and Symfony2
BDD with Behat and Symfony2BDD with Behat and Symfony2
BDD with Behat and Symfony2katalisha
 
You're Doing It Wrong
You're Doing It WrongYou're Doing It Wrong
You're Doing It Wrongbostonrb
 
Copycopter Presentation by Joe Ferris at BostonRB
Copycopter Presentation by Joe Ferris at BostonRBCopycopter Presentation by Joe Ferris at BostonRB
Copycopter Presentation by Joe Ferris at BostonRBbostonrb
 
"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, Temboo"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, TembooYandex
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Workhorse Computing
 
Presentation.Key
Presentation.KeyPresentation.Key
Presentation.Keyguesta2b31d
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructureLindsay Holmwood
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?ylefebvre
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecturepostrational
 
Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!Jessica Mauerhan
 

Tendances (19)

Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Implementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using CucumberImplementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using Cucumber
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
GAEO
GAEOGAEO
GAEO
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web Applications
 
BDD with Behat and Symfony2
BDD with Behat and Symfony2BDD with Behat and Symfony2
BDD with Behat and Symfony2
 
You're Doing It Wrong
You're Doing It WrongYou're Doing It Wrong
You're Doing It Wrong
 
Copycopter Presentation by Joe Ferris at BostonRB
Copycopter Presentation by Joe Ferris at BostonRBCopycopter Presentation by Joe Ferris at BostonRB
Copycopter Presentation by Joe Ferris at BostonRB
 
Cucumber testing
Cucumber testingCucumber testing
Cucumber testing
 
"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, Temboo"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, Temboo
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium
 
Presentation.Key
Presentation.KeyPresentation.Key
Presentation.Key
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
Selenium sandwich-2
Selenium sandwich-2Selenium sandwich-2
Selenium sandwich-2
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
Reliable acceptance testing
Reliable acceptance testingReliable acceptance testing
Reliable acceptance testing
 
Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!
 

En vedette

What Is Cucumber?
What Is Cucumber?What Is Cucumber?
What Is Cucumber?QATestLab
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With WatirTimothy Fisher
 
World: Melon Seed - Market Report. Analysis And Forecast To 2020
World: Melon Seed - Market Report. Analysis And Forecast To 2020World: Melon Seed - Market Report. Analysis And Forecast To 2020
World: Melon Seed - Market Report. Analysis And Forecast To 2020IndexBox Marketing
 
How to Perform A/B Testing?
How to Perform A/B Testing?How to Perform A/B Testing?
How to Perform A/B Testing?QATestLab
 
RHS Level 2 Certificate Year 1 Session 21
RHS Level 2 Certificate Year 1 Session 21RHS Level 2 Certificate Year 1 Session 21
RHS Level 2 Certificate Year 1 Session 21vikkis
 
The LAZY Developer's Guide to BDD (with Cucumber)
The LAZY Developer's Guide to BDD (with Cucumber)The LAZY Developer's Guide to BDD (with Cucumber)
The LAZY Developer's Guide to BDD (with Cucumber)Tze Yang Ng
 
Potentiality of protected cultivation in West Bengal
Potentiality of protected cultivation in West BengalPotentiality of protected cultivation in West Bengal
Potentiality of protected cultivation in West BengalSubham Ghosh
 
Ecological Management of Cucurbits
Ecological Management of CucurbitsEcological Management of Cucurbits
Ecological Management of CucurbitsJawwad Mirza
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumberDaniel Kummer
 
Greenhouse production of Cucumber
Greenhouse production of CucumberGreenhouse production of Cucumber
Greenhouse production of CucumberYourAgri
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberKMS Technology
 

En vedette (16)

What Is Cucumber?
What Is Cucumber?What Is Cucumber?
What Is Cucumber?
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With Watir
 
Watir
WatirWatir
Watir
 
World: Melon Seed - Market Report. Analysis And Forecast To 2020
World: Melon Seed - Market Report. Analysis And Forecast To 2020World: Melon Seed - Market Report. Analysis And Forecast To 2020
World: Melon Seed - Market Report. Analysis And Forecast To 2020
 
How to Perform A/B Testing?
How to Perform A/B Testing?How to Perform A/B Testing?
How to Perform A/B Testing?
 
RHS Level 2 Certificate Year 1 Session 21
RHS Level 2 Certificate Year 1 Session 21RHS Level 2 Certificate Year 1 Session 21
RHS Level 2 Certificate Year 1 Session 21
 
Improving Agricultural Productivity and Food Security in the Arabian Peninsul...
Improving Agricultural Productivity and Food Security in the Arabian Peninsul...Improving Agricultural Productivity and Food Security in the Arabian Peninsul...
Improving Agricultural Productivity and Food Security in the Arabian Peninsul...
 
The LAZY Developer's Guide to BDD (with Cucumber)
The LAZY Developer's Guide to BDD (with Cucumber)The LAZY Developer's Guide to BDD (with Cucumber)
The LAZY Developer's Guide to BDD (with Cucumber)
 
Potentiality of protected cultivation in West Bengal
Potentiality of protected cultivation in West BengalPotentiality of protected cultivation in West Bengal
Potentiality of protected cultivation in West Bengal
 
Ecological Management of Cucurbits
Ecological Management of CucurbitsEcological Management of Cucurbits
Ecological Management of Cucurbits
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Cucumber
CucumberCucumber
Cucumber
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 
Greenhouse production of Cucumber
Greenhouse production of CucumberGreenhouse production of Cucumber
Greenhouse production of Cucumber
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
BDD in Action - building software that matters
BDD in Action - building software that mattersBDD in Action - building software that matters
BDD in Action - building software that matters
 

Similaire à Outside-in Development with Cucumber and Rspec

Behavior Driven Development, Ruby Style
Behavior Driven Development, Ruby StyleBehavior Driven Development, Ruby Style
Behavior Driven Development, Ruby StyleBozhidar Batsov
 
Your fist RubyMotion Application
Your fist RubyMotion ApplicationYour fist RubyMotion Application
Your fist RubyMotion Applicationtoamitkumar
 
DevTeach12-betterspecs
DevTeach12-betterspecsDevTeach12-betterspecs
DevTeach12-betterspecsAmir Barylko
 
Agile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic QualityAgile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic QualityDemetrius Nunes
 
Behaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby StyleBehaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby StyleOpenFest team
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled CucumbersJoseph Wilk
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpinrajivmordani
 
Cucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongCucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongDmitry Sharkov
 
WE are Doing it Wrong - Dmitry Sharkov
WE are Doing it Wrong - Dmitry SharkovWE are Doing it Wrong - Dmitry Sharkov
WE are Doing it Wrong - Dmitry SharkovQA or the Highway
 
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...Puppet
 
Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Elliott Kember
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Eric Torreborre
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)Wooga
 
Super powered API testing
Super powered API testing Super powered API testing
Super powered API testing postmanclient
 
Web performance optimization for everyone
Web performance optimization for everyoneWeb performance optimization for everyone
Web performance optimization for everyoneitnig
 
090309 Rgam Presentatie Evernote And Tarpipe Final
090309   Rgam   Presentatie Evernote And Tarpipe Final090309   Rgam   Presentatie Evernote And Tarpipe Final
090309 Rgam Presentatie Evernote And Tarpipe Finalgebbetje
 
Looking glassrenderinglt en
Looking glassrenderinglt enLooking glassrenderinglt en
Looking glassrenderinglt en優介 黒河
 

Similaire à Outside-in Development with Cucumber and Rspec (20)

Cucumbered
CucumberedCucumbered
Cucumbered
 
Behavior Driven Development, Ruby Style
Behavior Driven Development, Ruby StyleBehavior Driven Development, Ruby Style
Behavior Driven Development, Ruby Style
 
Your fist RubyMotion Application
Your fist RubyMotion ApplicationYour fist RubyMotion Application
Your fist RubyMotion Application
 
DevTeach12-betterspecs
DevTeach12-betterspecsDevTeach12-betterspecs
DevTeach12-betterspecs
 
Agile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic QualityAgile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic Quality
 
Behaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby StyleBehaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby Style
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpin
 
Cucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongCucumber - We Are Doing It Wrong
Cucumber - We Are Doing It Wrong
 
WE are Doing it Wrong - Dmitry Sharkov
WE are Doing it Wrong - Dmitry SharkovWE are Doing it Wrong - Dmitry Sharkov
WE are Doing it Wrong - Dmitry Sharkov
 
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
ManagingPuppetConf 2017: Multiple Configuration Management Tools- Sally Lehma...
 
Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
 
Cucumber
CucumberCucumber
Cucumber
 
Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Twiggy - let's get our widget on!
Twiggy - let's get our widget on!
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)
 
Super powered API testing
Super powered API testing Super powered API testing
Super powered API testing
 
Web performance optimization for everyone
Web performance optimization for everyoneWeb performance optimization for everyone
Web performance optimization for everyone
 
090309 Rgam Presentatie Evernote And Tarpipe Final
090309   Rgam   Presentatie Evernote And Tarpipe Final090309   Rgam   Presentatie Evernote And Tarpipe Final
090309 Rgam Presentatie Evernote And Tarpipe Final
 
Looking glassrenderinglt en
Looking glassrenderinglt enLooking glassrenderinglt en
Looking glassrenderinglt en
 

Plus de Joseph Wilk

Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Joseph Wilk
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkJoseph Wilk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red SocietyJoseph Wilk
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society Joseph Wilk
 
Testing outside of the Ruby World
Testing outside of the Ruby WorldTesting outside of the Ruby World
Testing outside of the Ruby WorldJoseph Wilk
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talkJoseph Wilk
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startupAcceptance testing in the land of the startup
Acceptance testing in the land of the startupJoseph Wilk
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns WorkshopJoseph Wilk
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsJoseph Wilk
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with RubyJoseph Wilk
 

Plus de Joseph Wilk (13)

Frozenrails2011
Frozenrails2011Frozenrails2011
Frozenrails2011
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red Society
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society
 
Spa2011
Spa2011Spa2011
Spa2011
 
Testing outside of the Ruby World
Testing outside of the Ruby WorldTesting outside of the Ruby World
Testing outside of the Ruby World
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talk
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startupAcceptance testing in the land of the startup
Acceptance testing in the land of the startup
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns Workshop
 
Musichackday
MusichackdayMusichackday
Musichackday
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the Strings
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with Ruby
 

Dernier

UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 

Dernier (20)

UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 

Outside-in Development with Cucumber and Rspec

  • 1. utside in Development Cucumber Rspec Joseph Wilk / http://blog.josephwilk.net
  • 2. Why are you here?
  • 3. Why are you here? In order to ...
  • 4. Why are you here? In order to ... As a Scotland on Rails attendee
  • 5. Why are you here? In order to ... As a Scotland on Rails attendee I want ...
  • 7. Scenario: Happy SoR attendees Given people turned up When Joseph talks Then everyone should acquire some new knowledge And no-one should fall asleep And no rotten food should be thrown
  • 9. Outside-in User Browser Views Controllers Models
  • 10. Cucumber “The feature you wished you had” Views Controllers Rspec Models “The components and the interactions you wish you had”
  • 11. Cucumber “The feature you wished you had” Views Controllers Rspec Models “The components and the interactions you wish you had”
  • 12. Cucumber “The feature you wished you had” Views Controllers Rspec Models “The components and the interactions you wish you had”
  • 15. Cucumber / Scenario Rspec / code examples
  • 16. Cucumber / Scenario Rspec / code examples
  • 17. Cucumber / Scenario Rspec / code examples
  • 18. Cucumber / Scenario Rspec / code examples
  • 19. Cucumber / Scenario Rspec / code examples
  • 20. :rspec => route finder :cucumber => destination London Edinburgh
  • 22. Behaviour Driven Development with elegance and joy Just Cuke it!
  • 23. Plaintext Ruby Features step definitions
  • 24. Cucumber Feature Not executed Feature: Be awesome Narrative Scenario: title Example of Given <some context> behaviour And <yet more context> When <some action> And <more actions> Then <some outcome> And <more outcomes>
  • 25. regexp match Step definition Given /^we like (.*)$/i do |fruit| fruit.should == 'cukes' Ruby tests #assert_equal(fruit, 'cukes') end Plaintext Given we like cukes Feature Cucumber
  • 26. Plug and Pray Rspec Plaintext Ruby tests TestUnit Cucumber Ruby-Gnome2 Cucumber Sinatra Rails Merb iPhone
  • 28. огурец Russian Chinese concombre French Korean gurka Swedish Japanese German castravete Romanian Gurke ogórek Cucumber English Polish pepino Spanish Italian cetriolo Danish agurk ‫ﺍﳋﻴﺎﺭ‬ Arabic Indonisean ketimun
  • 29. огурец Russian Chinese concombre French Korean gurka Swedish Japanese German castravete Romanian Gurke ogórek Cucumber English Polish pepino Spanish Treetop Rocks Italian cetriolo ANTLR Danish agurk could rock ‫ﺍﳋﻴﺎﺭ‬ Arabic Indonisean harder ketimun
  • 30. Webrat Love visit home_path click_link quot;Webquot; fill_in quot;Emailquot;, :with => quot;Rat” click_button quot;Lovequot; Bansky
  • 31. Return On Investment Cucumber Feature
  • 32. Return On Investment Cucumber Feature • Token Conversation
  • 33. Return On Investment Cucumber Feature • Token Conversation • Acceptance Criteria
  • 34. Return On Investment Cucumber Feature • Token Conversation • Acceptance Criteria • Design
  • 35. Return On Investment Cucumber Feature • Token Conversation • Acceptance Criteria • Design • Documentation
  • 36. Return On Investment Cucumber Feature • Token Conversation • Acceptance Criteria • Design • Documentation • Functional test
  • 37. Return On Investment Cucumber Feature • Token Conversation • Acceptance Criteria • Design • Documentation • Functional test • Integration test
  • 40. Feature Request I want members to be able to rent a movie with a priority indicating how much they want to see the film
  • 41. Show me the _ _ _ _ _
  • 42. Show me the VA L U _ ____E
  • 44. Root Cause Analysis Why? So we can maximise allocation of films
  • 45. Root Cause Analysis Why? Keep customers happy Why? So we can maximise allocation of films
  • 46. Root Cause Analysis Why? So they continue with their subscriptions Why? Keep customers happy Why? So we can maximise allocation of films
  • 47. Root Cause Analysis Why? So they continue with their subscriptions Why? Keep customers happy Why? So we can maximise allocation of films
  • 49. Feature (terrible) Value Feature: select a movie to rent with priority In order to maximise allocation of films The website user Needs to be able to add movies to their rental list with a priority Role Feature
  • 50. Feature (terrible) Value Feature: select a movie to rent with priority In order to maximise allocation of films Narrative The website user Needs to be able to add movies to their rental list with a priority Role Feature
  • 51. Feature (terrible) Value Feature: select a movie to rent with priority In order to maximise allocation of films The website user Needs to be able to add movies to their rental list with a priority Role Feature
  • 52. Feature (terrible) Feature: select a movie to rent with priority In order to maximise allocation of films The website user Needs to be able to add movies to their rental list with a priority
  • 53. Feature (terrible) Feature: select a movie to rent with priority In order to maximise allocation of films The website user Needs to be able to add movies to their rental list with a priority Noise
  • 54. Feature (terrible) Feature: select a movie to rent with priority In order to maximise allocation of films The website user Needs to be able to add movies to their rental list with a priority Too generic role
  • 55. Feature (terrible) Feature: select a movie to rent with priority In order to maximise allocation of films The website user Film member Needs to be able to add movies to their rental list with a priority Too generic role
  • 56. Feature (terrible) Role can change feature Feature: select a movie to rent with priority In order to maximise allocation of films The website user Film member Needs to be able to add movies to their rental list with a priority
  • 57. Feature (terrible) Role can change feature Film Member selects a movie to rent with priority Feature: select a movie to rent with priority In order to maximise allocation of films The website user Film member Needs to be able to add movies to their rental list with a priority
  • 58. Nice Feature (terrible) Film Member selects a movie to rent with priority Feature: select a movie to rent with priority In order to maximise allocation of films The website user Film member Needs to be able to add movies to their rental list with a priority
  • 60. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Film member Needs to add movies to their rental list with a priority Scenario: High priority
  • 61. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Film member Needs to add movies to their rental list with a priority Scenario: High priority Then I should see quot;My rental listquot; And I should see quot;Casshernquot; in my rental list And quot;Casshernquot; should be marked as quot;High priorityquot;
  • 62. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Film member Needs to add movies to their rental list with a priority Scenario: High priority When I choose quot;High priorityquot; And I press quot;Rentquot; Then I should see quot;My rental listquot; And I should see quot;Casshernquot; in my rental list And quot;Casshernquot; should be marked as quot;High priorityquot;
  • 63. Scenarios Feature: Film Member selects a movie to rent with priority In order to maximise allocation of films The Film member Needs to add movies to their rental list with a priority Scenario: High priority Given I'm logged in And I am viewing the movie quot;Casshernquot; When I choose quot;High priorityquot; And I press quot;Rentquot; Then I should see quot;My rental listquot; And I should see quot;Casshernquot; in my rental list And quot;Casshernquot; should be marked as quot;High priorityquot;
  • 65. Let there be Cuking
  • 66. Demo High Resolution: http://www.screencast.com/t/aG1sE4N3Zq Low Resolution: http://www.vimeo.com/3910617
  • 68. Demo High Resolution: http://www.screencast.com/t/tlBYxkKci Low Resolution http://www.vimeo.com/3911104
  • 69. Installing Cucumber $ sudo gem install cucumber $ script/plugin install git://github.com/aslakhellesoy/ cucumber.git $ gem sources -a http://gems.github.com $ sudo gem install aslakhellesoy-cucumber
  • 70. Fixtures Scenario: search results found Given /^the Movies$/i do |movie_hash| Given the Movies #{:title => quot;The colour whitequot;}, | title | #{:title => quot;The colour redquot;}, | The colour white | #{:title => quot;Casshernquot;} | The colour red | movies.hashes.each do |values| | Casshern | Movie.create!(values) When I search for quot;colourquot; end Then I will see 2 results end Scenario: search results found Given 2 films with quot;colourquot; in the title When I search for quot;colourquot; Then I will see 2 results
  • 71. Stick it to the World module NavigationHelpers def path_to(page_name) case page_name when /the homepage/ root_path else raise quot;Can't find mapping from quot;#{page_name}quot; to a path.quot; end end end World do |world| world.extend NavigationHelpers world end
  • 72. Hooks Hooks are GLOBAL! Before do # do something before each scenario. end After do #do something after each scenario end
  • 73. How many scenarios is enough? • Given/When/Then “Finite state machine” Uncle Bob • What’s the Return on Investment?
  • 74. Cowcumbers (Bad smells) “fit only for consumption by cows”
  • 75. Cowcumbers Given /^dirty state$/ do @movie = Movie.create! Relying on state (too much) end Given /^coupled by state$/ do @movie.title = quot;yuckyquot; end Given /^does a user care$/ do response.current_url == ‘silly’ end Tests without user value Given /^checking the db$/ do Movie.find(1).should_not == nil end
  • 77. Concrete vs Abstract Scenarios Given I'm logged in Given I go to the login page And I fill in quot;usernamequot; with quot;josephquot; And I fill in quot;passwordquot; with quot;cukerquot; And I click quot;loginquot; Domain understanding Concrete Abstract
  • 78. Calling steps from steps Given /I’m logged in/ do User.create!(:user => 'josephwilk', :password => quot;passquot;) Given 'I fill in quot;passwordquot; with quot;josephwilkquot;' Given 'I fill in quot;passwordquot; with quot;passquot;' Given 'I click quot;loginquot;' end
  • 79. Feature Request Can you add some of that funky AJAX stuff for the rent button
  • 81. Watir, Selenium & Celerity Browser based Headless Browser • • Watir Celerity • • Selenium Culerity - http:// github.com/langalex/ culerity/tree/master
  • 82. Webrat / Selenium # Sets up the Rails environment for Cucumber ENV[quot;RAILS_ENVquot;] ||= quot;seleniumquot; require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'cucumber/rails/world' require 'cucumber/formatters/unicode' Turn off #Cucumber::Rails.use_transactional_fixtures require 'webrat' Webrat.configure do |config| Switch to Selenium config.mode = :selenium end require 'cucumber/rails/rspec' require 'webrat/core/matchers' Before do Movie.delete_all Manually cleanup RentalRequest.delete_all end
  • 83. Organising @in-progress Feature: Verify billing Tag @js Scenario: Missing product description Scenario: Several products cucumber --profile rails --tags ~@js cucumber --profile browser --tags @js
  • 84. Demo High Resolution: http://www.screencast.com/t/1jRSI6TvXWu Low Resolution: http://www.vimeo.com/3911241
  • 85. Further reading • http://cukes.info • http://wiki.github.com/ aslakhellesoy/cucumber • http://rspec.info/ • http://blog.josephwilk.net
  • 86. Thanks joe@josephwilk.net http://github.com/josephwilk