Features

How to select the Operating System and Browser you want to run your tests on


You can choose between various browsers and operating systems to run your test on.

After you've determined the browser and OS you want to run your test on, you need to specify what you would like in your test.

Below are some examples on how to do this with Selenium RC code:

PHP Code:

In the example below we will run the test on Firefox 8.

<?php

	class SimpleTest extends PHPUnit_Extensions_TestingBotTestCase
	{
	    protected function setUp()
	    {
	    	$this->setBrowserVersion(8);
	    	$this->setPlatform('Windows');
	    	$this->setBrowser('Firefox');
	    }
	}

Ruby Code:

In the example below we will run the test on Safari 5.

require "rubygems"
gem "selenium-client"
require "selenium/client"
gem 'test-unit'
require 'test/unit'

gem "testingbot"
require "testingbot"
class ExampleTest < TestingBot::TestCase
  attr_reader :browser

  def setup
    @browser = Selenium::Client::Driver.new \
        :host => "hub.testingbot.com",
        :port => 80,
        :browser => "firefox",
        :version => "latest",
        :platform => "WINDOWS",
        :url => "https://testingbot.com",
        :timeout_in_second => 60
    browser.start_new_browser_session
  end

C# Code:

In the example below we will run the test on Internet Explorer 9.

using NUnit.Framework;
using System;
using Selenium;
using System.Web;
using System.Text;
using System.Net;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;

namespace Test
{
    [TestFixture()]
    public class Test
    {
       private IWebDriver driver;

        [SetUp]
        public void Init()
        {
            DesiredCapabilities capabillities = DesiredCapabilities.InternetExplorer();
            capabillities.SetCapability(CapabilityType.Version, "9");
			capabillities.SetCapability("api_key", "REPLACE_API_KEY");
            capabillities.SetCapability("api_secret", "REPLACE_API_SECRET");

            driver = new RemoteWebDriver(
                new Uri("http://hub.testingbot.com/wd/hub/"), capabillities);
        }

        [Test]
        public void TestCase()
        {
            driver.Navigate().GoToUrl("https://www.google.com");
            StringAssert.Contains("Google", driver.Title);
        }

        [TearDown]
        public void Cleanup()
        {
            driver.Quit();
        }
   }
}