Getting Started :: Sauce OnDemand
You'll need …
Install Selenium 2 ruby bindings
From a terminal:
gem install selenium-webdriver
Code
require 'rubygems'
require "test/unit"
require 'selenium-webdriver'
class ExampleTest < Test::Unit::TestCase
def setup
caps = Selenium::WebDriver::Remote::Capabilities.firefox
caps.version = "5"
caps.platform = :XP
caps[:name] = "Testing Selenium 2 with Ruby on Sauce"
@driver = Selenium::WebDriver.for(
:remote,
:url => "http://username-string:access-key-string@ondemand.saucelabs.com:80/wd/hub",
:desired_capabilities => caps)
end
def test_sauce
@driver.navigate.to "http://saucelabs.com/test/guinea-pig"
assert @driver.title.include?("I am a page title - Sauce Labs")
end
def teardown
@driver.quit
end
end
Run your first test
- Copy the above code into a file named
basic-example.rb - Run the test:
ruby basic-example.rb
- The test should now appear in your account page.
Get saucy
- Your first test just ran! Check out the results on your account page.
- This test is a great starting point for making more.
- Click the "It Worked!" button below, and see the available OnDemand integrations.
