SlideShare una empresa de Scribd logo
1 de 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
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;
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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!
 

Destacado

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
 

Destacado (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
 

Similar a 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
 
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
 
Cucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongCucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongDmitry 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...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優介 黒河
 

Similar a 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
 
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
 
Cucumber - We Are Doing It Wrong
Cucumber - We Are Doing It WrongCucumber - We Are Doing It Wrong
Cucumber - We Are Doing It Wrong
 
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
 

Más 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
 

Más 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
 

Último

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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
  • 39.
  • 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;
  • 64.
  • 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