SlideShare a Scribd company logo
1 of 37
Download to read offline
How green is my cucumber?

Monday, 2 November 2009
Refactoring the Cuke

            Latest version is 0.4.x

                  Breaks things

                  Fixes things

                  Adds new things

                  Different approach

            We need to refactor our Cucumber setup and usage


Monday, 2 November 2009
Breakages


            Cucumber::Rails.bypass_rescue

            Cucumber::Rails.use_transactional_fixtures




Monday, 2 November 2009
New - Tags

            @no-txn tag

                  used to turn off normal transactions for scenarios

                  we can use with database cleaner via tagged hooks

            @allow-rescue tag

                  allows errors to be caught be Rails (not Cucumber)



Monday, 2 November 2009
New - Multiline Tables


            allows tables as arguments for steps

            not the same as scenario outlines




Monday, 2 November 2009
Given the          following people exist:
         | name           | email           | phone   |
         | Aslak          | aslak@email.com | 123     |
         | Joe            | joe@email.com   | 234     |
         | Bryan          | bryan@email.org | 456     |

       Given /the following people exist:/ do |people_table|
         people_table.hashes.each do |hash|
           # The first time the +hash+ will contain:
           #   {'name' => 'Aslak', 'email' => 'aslak@email.com', 'phone' => '123'}
           # The second time:
           #   {'name' => 'Joe', 'email' => 'joe@email.com', 'phone' => '234'}
           # etc.
         end
       end




Monday, 2 November 2009
New - Diff’ing Tables

            can compare a table argument to another table

            typically done in a Then step

            new convenience Webrat method that turns a HTML table
            into an Array of Array:

                          expected_cukes_table.diff!(table_at('#cuke_table').to_a)




Monday, 2 November 2009
Then I should see the   following cukes:
         | Latin           |   English      |
         | Cucumis sativus |   Cucumber     |
         | Cucumis anguria |   Burr Gherkin |

       Then /^I should see the following cukes:$/ do |expected_cukes_table|
         actual_table = [
           ['Latin', 'English'],
           ['Cucumis sativus', 'Concombre'],
           ['Cucumis anguria', 'Burr Gherkin']
         ] # In practice you'd pull this out of a web page or database

         expected_cukes_table.diff!(actual_table)
       end




Monday, 2 November 2009
New - Multiline Strings


            uses PyString syntax of three double-quote marks

            text automatically yielded as last parameter of step definition




Monday, 2 November 2009
Given a blog post named "Random" with Markdown body
         """
         Some Title, Eh?
         ==============
         Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet,
         consectetur adipiscing elit.
         """

       Given /^a blog post named "([^"]*)" with Markdown body$/ do |title,
       markdown|
         Post.create!(:title => title, :body => markdown)
       end




Monday, 2 November 2009
New - Webrat Steps

            extra default webrat steps including:

                  “Then show me the page”

                  see within eg Then I should see “text” within “selector”

                  see regex eg Then I should see /regex/

                  Given I am on, When I go to, Then I should be on ...

                  When I fill in the following (table of form values)


Monday, 2 November 2009
New - Step Transforms
            Step argument transforms

                  helps DRY up step definitions

                  see for more info:
                  http://wiki.github.com/aslakhellesoy/cucumber/step-
                  argument-transforms

                  and:
                  http://www.engineyard.com/blog/2009/cucumber-step-
                  argument-transforms/

Monday, 2 November 2009
New - PDF Formatter


            use --format pdf --out filename.pdf

            requires prawn




Monday, 2 November 2009
New - Screenshots


            selenium only

            webrat method:

                  save_and_open_screengrab




Monday, 2 November 2009
The New Cucumber Way


            env.rb is expected to be managed by Cucumber

            custom code should be put into separate files




Monday, 2 November 2009
env.rb

            big warning message

            transactional fixtures

            allow rescue

            cucumber settings

            webrat settings



Monday, 2 November 2009
#   IMPORTANT: This file was generated by Cucumber 0.4.0
       #   Edit at your own peril - it's recommended to regenerate this file
       #   in the future when you upgrade to a newer version of Cucumber.
       #   Consider adding your own code to a new file instead of editing this one.




Monday, 2 November 2009
ENV["RAILS_ENV"] ||= "cucumber"
       require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
       require 'cucumber/rails/world'




Monday, 2 November 2009
Cucumber::Rails::World.use_transactional_fixtures = true




Monday, 2 November 2009
ActionController::Base.allow_rescue = false




Monday, 2 November 2009
require            'cucumber'
       require            'cucumber/formatter/unicode'
       require            'cucumber/webrat/element_locator'
       require            'cucumber/rails/rspec'




Monday, 2 November 2009
require 'webrat'
       require 'webrat/core/matchers'
       Webrat.configure do |config|
         config.mode = :rails
         config.open_error_files = false
       end




Monday, 2 November 2009
New AMC Cuking Way

            cucumber.yml can now exist in config directory

            pickle, machinist, webrat, sphinx, db cleaner, and stubbing all
            separate files

            env.rb is now pristine

                  no more manual updating

                  to update cucumber simply script/generate cucumber



Monday, 2 November 2009
cucumber.yml

            moved to config directory

            profiles simplfied

                  default

                  selenium

                  no more sphinx profile

            Textmate shell variable TM_CUCUMBER_OPTS changed


Monday, 2 November 2009
default:
             -t ~@selenium
             -r features
             RAILS_ENV=test




Monday, 2 November 2009
selenium:
             -t @selenium
             -r features
             RAILS_ENV=test
             WEBRAT_MODE=selenium



Monday, 2 November 2009
$         cucumber
       $         cucumber -t ~@no-txn
       $         cucumber -p selenium
       $         cucumber -t @sphinx




Monday, 2 November 2009
TM_CUCUMBER_OPTS:
           -t ~@selenium,~@sphinx
           -r features
           --format html




Monday, 2 November 2009
Pickle & Machinst

            Pickle

                  moved to features/support/pickle.rb

                  but script/generate pickle automatically appends to env.rb

            Machinist

                  moved to features/support/machinist.rb



Monday, 2 November 2009
Database Cleaner


            separated out to features/support/db_cleaner.rb

            used by all non-transactional scenarios eg sphinx & selenium

            uses tagged before and after hooks (@no-txn) to clean the
            database




Monday, 2 November 2009
Sphinx
            remains at features/support/sphinx.rb

            scenarios that use sphinx must be tagged with @sphinx AND
            @no-txn so that these features are not run in a transaction

            database cleaning pulled out into database_cleaner.rb

            still use tagged before hook to reindex

            uses at_exit to stop searchd

            searchd runs on its own port specified in sphinx.yml

Monday, 2 November 2009
Webrat & Selenium
            remains in features/support/webrat.rb

            webrat can only run in rails or selenium mode (not both at the
            same time)

            we use ENV[‘WEBRAT_MODE’] in profiles in set selenium
            mode

            defaults to rails mode

            selenium scenarios tagged with @selenium AND @no-txn


Monday, 2 November 2009
Extras


            moved to features/support/env_extra.rb

            enable RSpec's stubbing support, specifically for stubbing
            Time.now

            with RSpec 1.2.8, enabling stubbing is now a single require




Monday, 2 November 2009
require 'spec/stubs/cucumber'




Monday, 2 November 2009
Using Multiple Cukes

            unpacked cucumber gem into /vendor/gems

            cuke bash function

                  selectively uses vendored of system cucumber binary

                  overcomes problems with using different cucumbers on
                  different projects and having new versions of cucumber
                  breaking your project’s features



Monday, 2 November 2009
function cuke {
         vendor_cuke_path="vendor/gems/cucumber*/bin/cucumber"
         if [ -x $vendor_cuke_path ]; then
            eval $vendor_cuke_path $@
         else
            cucumber $@
         fi
       }




Monday, 2 November 2009
http://www.flickr.com/photos/knittingskwerlgurl/3731055596/


Monday, 2 November 2009

More Related Content

What's hot

More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails epiineg1
 
Getting Started with PoolParty and EC2
Getting Started with PoolParty and EC2Getting Started with PoolParty and EC2
Getting Started with PoolParty and EC2Nate Murray
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsMartin Jackson
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementFrederik Engelen
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Jude A. Goonawardena
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortegaarman o
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
Automating with ansible (Part B)
Automating with ansible (Part B)Automating with ansible (Part B)
Automating with ansible (Part B)iman darabi
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails DevsDiacode
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)iman darabi
 
Scaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesScaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesAndrew Turner
 

What's hot (20)

CakePHP + PostgreSQL
CakePHP + PostgreSQLCakePHP + PostgreSQL
CakePHP + PostgreSQL
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails
 
Getting Started with PoolParty and EC2
Getting Started with PoolParty and EC2Getting Started with PoolParty and EC2
Getting Started with PoolParty and EC2
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data Patterns
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)Introduction to Ansible - (dev ops for people who hate devops)
Introduction to Ansible - (dev ops for people who hate devops)
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortega
 
Pfm technical-inside
Pfm technical-insidePfm technical-inside
Pfm technical-inside
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
Httpd.conf
Httpd.confHttpd.conf
Httpd.conf
 
Chef
ChefChef
Chef
 
Automating with ansible (Part B)
Automating with ansible (Part B)Automating with ansible (Part B)
Automating with ansible (Part B)
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
Ansible 202
Ansible 202Ansible 202
Ansible 202
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
 
Scaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesScaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web Services
 

Viewers also liked

Concept ontwikkelingsplan kazerneterreinen
Concept ontwikkelingsplan kazerneterreinenConcept ontwikkelingsplan kazerneterreinen
Concept ontwikkelingsplan kazerneterreinenKazerneterreinen
 
That thing lara croft
That thing lara croftThat thing lara croft
That thing lara croftnicolaheff
 
Audience feedback
Audience feedbackAudience feedback
Audience feedbacknicolaheff
 
Pozyskane środki przez Miasto Radomsko
Pozyskane środki przez Miasto Radomsko Pozyskane środki przez Miasto Radomsko
Pozyskane środki przez Miasto Radomsko MiastoRadomsko
 

Viewers also liked (7)

Concept ontwikkelingsplan kazerneterreinen
Concept ontwikkelingsplan kazerneterreinenConcept ontwikkelingsplan kazerneterreinen
Concept ontwikkelingsplan kazerneterreinen
 
Adwize Profile
Adwize ProfileAdwize Profile
Adwize Profile
 
That thing lara croft
That thing lara croftThat thing lara croft
That thing lara croft
 
Usability Testing
Usability TestingUsability Testing
Usability Testing
 
Audience feedback
Audience feedbackAudience feedback
Audience feedback
 
Pozyskane środki przez Miasto Radomsko
Pozyskane środki przez Miasto Radomsko Pozyskane środki przez Miasto Radomsko
Pozyskane środki przez Miasto Radomsko
 
Scheduling
SchedulingScheduling
Scheduling
 

Similar to Cucumber Upgrade

Game Changing Dependency Management
Game Changing Dependency ManagementGame Changing Dependency Management
Game Changing Dependency ManagementJeremy Kendall
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and GherkinPhase2
 
Getting Started with (Distributed) Version Control
Getting Started with (Distributed) Version ControlGetting Started with (Distributed) Version Control
Getting Started with (Distributed) Version ControlJohn Paulett
 
How to make DSL
How to make DSLHow to make DSL
How to make DSLYukio Goto
 
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetPer Bernhardt
 
Building Sencha Themes
Building Sencha ThemesBuilding Sencha Themes
Building Sencha ThemesSencha
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and SpeedSalesforce Marketing Cloud
 
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 20092009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009Caue Guerra
 
Welcome to the Symfony2 World - FOSDEM 2013
 Welcome to the Symfony2 World - FOSDEM 2013 Welcome to the Symfony2 World - FOSDEM 2013
Welcome to the Symfony2 World - FOSDEM 2013Lukas Smith
 
The State of the Social Desktop 2009
The State of the Social Desktop 2009The State of the Social Desktop 2009
The State of the Social Desktop 2009Frank Karlitschek
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
Introduction to Ruby & Ruby on Rails
Introduction to Ruby & Ruby on RailsIntroduction to Ruby & Ruby on Rails
Introduction to Ruby & Ruby on RailsMarcelo Pinheiro
 
What to do when things go wrong
What to do when things go wrongWhat to do when things go wrong
What to do when things go wrongDorneles Treméa
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3Blazing Cloud
 

Similar to Cucumber Upgrade (20)

Btree Nosql Oak
Btree Nosql OakBtree Nosql Oak
Btree Nosql Oak
 
Game Changing Dependency Management
Game Changing Dependency ManagementGame Changing Dependency Management
Game Changing Dependency Management
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and Gherkin
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Getting Started with (Distributed) Version Control
Getting Started with (Distributed) Version ControlGetting Started with (Distributed) Version Control
Getting Started with (Distributed) Version Control
 
How to make DSL
How to make DSLHow to make DSL
How to make DSL
 
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
 
Aplicacoes dinamicas gurusc
Aplicacoes dinamicas guruscAplicacoes dinamicas gurusc
Aplicacoes dinamicas gurusc
 
Building Sencha Themes
Building Sencha ThemesBuilding Sencha Themes
Building Sencha Themes
 
App Lego
App LegoApp Lego
App Lego
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 20092009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
 
Welcome to the Symfony2 World - FOSDEM 2013
 Welcome to the Symfony2 World - FOSDEM 2013 Welcome to the Symfony2 World - FOSDEM 2013
Welcome to the Symfony2 World - FOSDEM 2013
 
The State of the Social Desktop 2009
The State of the Social Desktop 2009The State of the Social Desktop 2009
The State of the Social Desktop 2009
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Introduction to Ruby & Ruby on Rails
Introduction to Ruby & Ruby on RailsIntroduction to Ruby & Ruby on Rails
Introduction to Ruby & Ruby on Rails
 
What to do when things go wrong
What to do when things go wrongWhat to do when things go wrong
What to do when things go wrong
 
MySQL Sandbox 3
MySQL Sandbox 3MySQL Sandbox 3
MySQL Sandbox 3
 
Active Record Introduction - 3
Active Record Introduction - 3Active Record Introduction - 3
Active Record Introduction - 3
 

Cucumber Upgrade

  • 1. How green is my cucumber? Monday, 2 November 2009
  • 2. Refactoring the Cuke Latest version is 0.4.x Breaks things Fixes things Adds new things Different approach We need to refactor our Cucumber setup and usage Monday, 2 November 2009
  • 3. Breakages Cucumber::Rails.bypass_rescue Cucumber::Rails.use_transactional_fixtures Monday, 2 November 2009
  • 4. New - Tags @no-txn tag used to turn off normal transactions for scenarios we can use with database cleaner via tagged hooks @allow-rescue tag allows errors to be caught be Rails (not Cucumber) Monday, 2 November 2009
  • 5. New - Multiline Tables allows tables as arguments for steps not the same as scenario outlines Monday, 2 November 2009
  • 6. Given the following people exist: | name | email | phone | | Aslak | aslak@email.com | 123 | | Joe | joe@email.com | 234 | | Bryan | bryan@email.org | 456 | Given /the following people exist:/ do |people_table| people_table.hashes.each do |hash| # The first time the +hash+ will contain: # {'name' => 'Aslak', 'email' => 'aslak@email.com', 'phone' => '123'} # The second time: # {'name' => 'Joe', 'email' => 'joe@email.com', 'phone' => '234'} # etc. end end Monday, 2 November 2009
  • 7. New - Diff’ing Tables can compare a table argument to another table typically done in a Then step new convenience Webrat method that turns a HTML table into an Array of Array: expected_cukes_table.diff!(table_at('#cuke_table').to_a) Monday, 2 November 2009
  • 8. Then I should see the following cukes: | Latin | English | | Cucumis sativus | Cucumber | | Cucumis anguria | Burr Gherkin | Then /^I should see the following cukes:$/ do |expected_cukes_table| actual_table = [ ['Latin', 'English'], ['Cucumis sativus', 'Concombre'], ['Cucumis anguria', 'Burr Gherkin'] ] # In practice you'd pull this out of a web page or database expected_cukes_table.diff!(actual_table) end Monday, 2 November 2009
  • 9. New - Multiline Strings uses PyString syntax of three double-quote marks text automatically yielded as last parameter of step definition Monday, 2 November 2009
  • 10. Given a blog post named "Random" with Markdown body """ Some Title, Eh? ============== Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet, consectetur adipiscing elit. """ Given /^a blog post named "([^"]*)" with Markdown body$/ do |title, markdown| Post.create!(:title => title, :body => markdown) end Monday, 2 November 2009
  • 11. New - Webrat Steps extra default webrat steps including: “Then show me the page” see within eg Then I should see “text” within “selector” see regex eg Then I should see /regex/ Given I am on, When I go to, Then I should be on ... When I fill in the following (table of form values) Monday, 2 November 2009
  • 12. New - Step Transforms Step argument transforms helps DRY up step definitions see for more info: http://wiki.github.com/aslakhellesoy/cucumber/step- argument-transforms and: http://www.engineyard.com/blog/2009/cucumber-step- argument-transforms/ Monday, 2 November 2009
  • 13. New - PDF Formatter use --format pdf --out filename.pdf requires prawn Monday, 2 November 2009
  • 14. New - Screenshots selenium only webrat method: save_and_open_screengrab Monday, 2 November 2009
  • 15. The New Cucumber Way env.rb is expected to be managed by Cucumber custom code should be put into separate files Monday, 2 November 2009
  • 16. env.rb big warning message transactional fixtures allow rescue cucumber settings webrat settings Monday, 2 November 2009
  • 17. # IMPORTANT: This file was generated by Cucumber 0.4.0 # Edit at your own peril - it's recommended to regenerate this file # in the future when you upgrade to a newer version of Cucumber. # Consider adding your own code to a new file instead of editing this one. Monday, 2 November 2009
  • 18. ENV["RAILS_ENV"] ||= "cucumber" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'cucumber/rails/world' Monday, 2 November 2009
  • 21. require 'cucumber' require 'cucumber/formatter/unicode' require 'cucumber/webrat/element_locator' require 'cucumber/rails/rspec' Monday, 2 November 2009
  • 22. require 'webrat' require 'webrat/core/matchers' Webrat.configure do |config| config.mode = :rails config.open_error_files = false end Monday, 2 November 2009
  • 23. New AMC Cuking Way cucumber.yml can now exist in config directory pickle, machinist, webrat, sphinx, db cleaner, and stubbing all separate files env.rb is now pristine no more manual updating to update cucumber simply script/generate cucumber Monday, 2 November 2009
  • 24. cucumber.yml moved to config directory profiles simplfied default selenium no more sphinx profile Textmate shell variable TM_CUCUMBER_OPTS changed Monday, 2 November 2009
  • 25. default: -t ~@selenium -r features RAILS_ENV=test Monday, 2 November 2009
  • 26. selenium: -t @selenium -r features RAILS_ENV=test WEBRAT_MODE=selenium Monday, 2 November 2009
  • 27. $ cucumber $ cucumber -t ~@no-txn $ cucumber -p selenium $ cucumber -t @sphinx Monday, 2 November 2009
  • 28. TM_CUCUMBER_OPTS: -t ~@selenium,~@sphinx -r features --format html Monday, 2 November 2009
  • 29. Pickle & Machinst Pickle moved to features/support/pickle.rb but script/generate pickle automatically appends to env.rb Machinist moved to features/support/machinist.rb Monday, 2 November 2009
  • 30. Database Cleaner separated out to features/support/db_cleaner.rb used by all non-transactional scenarios eg sphinx & selenium uses tagged before and after hooks (@no-txn) to clean the database Monday, 2 November 2009
  • 31. Sphinx remains at features/support/sphinx.rb scenarios that use sphinx must be tagged with @sphinx AND @no-txn so that these features are not run in a transaction database cleaning pulled out into database_cleaner.rb still use tagged before hook to reindex uses at_exit to stop searchd searchd runs on its own port specified in sphinx.yml Monday, 2 November 2009
  • 32. Webrat & Selenium remains in features/support/webrat.rb webrat can only run in rails or selenium mode (not both at the same time) we use ENV[‘WEBRAT_MODE’] in profiles in set selenium mode defaults to rails mode selenium scenarios tagged with @selenium AND @no-txn Monday, 2 November 2009
  • 33. Extras moved to features/support/env_extra.rb enable RSpec's stubbing support, specifically for stubbing Time.now with RSpec 1.2.8, enabling stubbing is now a single require Monday, 2 November 2009
  • 35. Using Multiple Cukes unpacked cucumber gem into /vendor/gems cuke bash function selectively uses vendored of system cucumber binary overcomes problems with using different cucumbers on different projects and having new versions of cucumber breaking your project’s features Monday, 2 November 2009
  • 36. function cuke { vendor_cuke_path="vendor/gems/cucumber*/bin/cucumber" if [ -x $vendor_cuke_path ]; then eval $vendor_cuke_path $@ else cucumber $@ fi } Monday, 2 November 2009