SlideShare a Scribd company logo
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

More Related Content

What's hot

Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
Dougal 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 Cucumber
TechWell
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
Shinichi Nishikawa
 
GAEO
GAEOGAEO
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 Applications
James Da Costa
 
BDD with Behat and Symfony2
BDD with Behat and Symfony2BDD with Behat and Symfony2
BDD with Behat and Symfony2
katalisha
 
You're Doing It Wrong
You're Doing It WrongYou're Doing It Wrong
You're Doing It Wrong
bostonrb
 
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, Temboo
Yandex
 
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 infrastructure
Lindsay Holmwood
 
Selenium sandwich-2
Selenium sandwich-2Selenium sandwich-2
Selenium sandwich-2
Workhorse Computing
 
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 architecture
postrational
 
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
 

What's hot (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!
 

Viewers also liked

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 Watir
Timothy Fisher
 
Watir
WatirWatir
Watir
Sai Venkat
 
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
IndexBox 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 Bengal
Subham 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 cucumber
Daniel Kummer
 
Cucumber
CucumberCucumber
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
Qwinix Technologies
 
Greenhouse production of Cucumber
Greenhouse production of CucumberGreenhouse production of Cucumber
Greenhouse production of Cucumber
YourAgri
 
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
 
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
John Ferguson Smart Limited
 

Viewers also liked (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 to Outside-in Development with Cucumber and Rspec

Cucumbered
CucumberedCucumbered
Cucumbered
Joseph Wilk
 
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-betterspecs
Amir Barylko
 
Agile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic QualityAgile Software Development with Intrinsic Quality
Agile Software Development with Intrinsic Quality
Demetrius Nunes
 
Behaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby StyleBehaviour-Driven Development, Ruby Style
Behaviour-Driven Development, Ruby Style
OpenFest team
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
Joseph 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 Wrong
Dmitry 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 Sharkov
QA 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
 
Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
selvanathankapilan
 
Cucumber
CucumberCucumber
Cucumber
Bachue Zhou
 
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 everyone
itnig
 
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 to 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
 

More from 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 talk
Joseph Wilk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red Society
Joseph Wilk
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society
Joseph Wilk
 
Spa2011
Spa2011Spa2011
Spa2011
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
 
Musichackday
MusichackdayMusichackday
Musichackday
Joseph 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 Ruby
Joseph Wilk
 

More from 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
 

Recently uploaded

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 

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