= TestingBot Testingbot.com is a website where you can use our cloud based Selenium grid. Test your web applications in various environments/browsers/devices. == How to install? You can install our testingbot ruby-gem by running "gem install testingbot" on your commandline. $ gem install testingbot == Setup After you installed the gem you need to run a one part setup. Type testingbot in your commandline and fill in the API key and API secret you obtained on http://www.testingbot.com $ testingbot == Usage === Example Test::Unit You can find an example in our examples folder, try something like this: require "rubygems" require "testingbot" class ExampleTest < TestingBot::TestCase attr_reader :browser def setup @browser = Selenium::Client::Driver.new \ :host => "hub.testingbot.com", :port => 4444, :browser => "firefox", :url => "http://www.google.com", :platform => "WINDOWS", :version => 10, :timeout_in_second => 60 browser.options = { :screenshot => true } browser.start_new_browser_session end def teardown browser.close_current_browser_session end def test_page_search browser.open "/" assert_equal "Google", browser.title end end === Example RSpec 2 This example uses RSpec 2. You can run it with rspec test_rspec.rb require 'rubygems' require "selenium/client" require 'rspec' require 'testingbot' describe "Test", :type => :selenium do attr_reader :selenium_driver before(:all) do @selenium_driver = Selenium::Client::Driver.new \ :host => "hub.testingbot.com", :port => 4444, :browser => "firefox", :url => "http://www.google.com", :timeout_in_second => 60, :platform => "WINDOWS", :version => "10" end before(:each) do @selenium_driver.start_new_browser_session end after(:each) do @selenium_driver.close_current_browser_session end it "can find the right title" do @selenium_driver.open "/" @selenium_driver.title.should eql("Google") end end === Example RSpec 1 This example uses RSpec 1. You can run it with spec test_rspec1.rb require 'rubygems' gem "rspec", "<2" gem "selenium-client" require "selenium/client" require "selenium/rspec/spec_helper" gem "testingbot" require "testingbot" describe "Test" do attr_reader :selenium_driver alias :page :selenium_driver before(:all) do @selenium_driver = Selenium::Client::Driver.new \ :host => "hub.testingbot.com", :port => 4444, :browser => "firefox", :url => "http://www.google.com", :timeout_in_second => 60, :platform => "WINDOWS", :version => "10" end before(:each) do selenium_driver.start_new_browser_session end append_after(:each) do @selenium_driver.close_current_browser_session end it "can find the right title" do page.open "/" page.title.should eql("Google") end end === Example RSpec 2 and Capybara This example uses RSpec 2 together with capybara and Selenium webdriver. You can run it with rspec capybara.rb require 'rspec' require 'capybara/rspec' require 'selenium/webdriver' require 'testingbot' RSpec.configure do |config| caps = Selenium::WebDriver::Remote::Capabilities.firefox caps.version = "8" caps.platform = :WINDOWS Capybara.default_driver = :testingbot Capybara.register_driver :testingbot do |app| client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 120 Capybara::Selenium::Driver.new(app, :browser => :remote, :url => "http://key:secret@hub.testingbot.com:4444/wd/hub", :http_client => client, :desired_capabilities => caps) end end describe "Test", :type => :request do before :all do Capybara.app_host = "http://testingbot.com" end it 'has a homepage with the word Selenium' do visit '/' page.should have_content('Selenium') end end == Extra options You can specify extra options like enabling/disabling the screenrecording or screenshot feature. (browser.options) There's also an option to pass along extra data with your test, which will be visible on testingbot.com. For example a build number, or other custom data. (browser.extra = "") == More information Get more information on http://www.testingbot.com == Copyright Copyright (c) 2012 TestingBot Please see our LICENSE