Skip to content

Multi Browser Testing with Rspec 2

testingbot edited this page Apr 9, 2012 · 1 revision

To run the same RSpec tests on multiple browsers, we added an around hook into RSpec 2 which accepts a :multibrowser filter.

First, specify in TestingBot::config which browsers you would like to test on by setting the desired_capabilities option, as shown below.

Use the :multibrowser => true statement to indicate you want to test on multiple browsers.

require 'rubygems'
require "selenium/client"
require 'rspec'
require 'testingbot'
require 'testingbot/tunnel'

TestingBot::config do |config|
  config[:desired_capabilities] = [
    { :browserName => "firefox", :version => 9, :platform => "WINDOWS" }, 
    { :browserName => "firefox", :version => 11, :platform => "WINDOWS" }
  ]
end

describe "Google", :type => :selenium, :multibrowser => true do
    it "can find the right title" do    
      page.navigate.to "http://www.google.com"
      page.title.should eql("Google")   
    end
end
Clone this wiki locally