Archive for May, 2012

TestingBot and BrowserMob Proxy

Today we have added support for using a BrowserMob proxy together with our Selenium grid.

By using this proxy, you can manipulate HTTP traffic during your tests, and do some other cool things too:

  • Simulate network latency/traffic
  • Capture performance data in HAR files
  • Rewrite HTTP requests and responses
  • Set and get HTTP headers

We provide a private and secure proxy for every customer, free of charge.
The traffic flowing through this proxy will only be available to you.

Below is an example on how to start and use a proxy.

Starting a new Proxy

To start a proxy, please make a GET request to our API

curl -u API_KEY:API_SECRET http://api.testingbot.com/v1/tunnel

We will boot up a pristine virtual machine for you, which should take no longer than 45 seconds.
Once the machine is booted, make the same request again to obtain the IP address of your personal VM.
Now that you have the IP, you can start using the proxy and do some interesting things.

Use the proxy

In this example, we’ll capture performance data in a HAR file for a single Selenium test in Ruby.

Start off by creating a listener on a free port:

curl -X POST http://IP:9090/proxy

This call will return a free port (for example 9091), which you need to use in your test.
Also, create a HAR attached to the port you obtained:

curl -x PUT http://IP:9090/proxy/9091/har

Now run the test with your proxy:

#!/usr/bin/env ruby
require "rubygems"
require 'testingbot'
gem "selenium-webdriver"
require "selenium-webdriver"

caps = {
  :browserName => "firefox",
  :version => "10",
  :platform => "WINDOWS",
  :proxy => Selenium::WebDriver::Proxy.new(:http => "IP:9091") #use the 9091 port we retrieved earlier
}

urlhub = "http://API_KEY:API_SECRET@hub.testingbot.com:4444/wd/hub"
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120

@webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client
@webdriver.navigate.to "http://testingbot.com/"
puts @webdriver.title
@webdriver.quit
		

When the test has finished running, you can fetch the HAR file from your personal proxy:

curl http://IP:9090/proxy/9091/har

We have added a page in our support area with this browsermob proxy example.

Should you have any questions about this, please let us know in the comments or contact us.

VN:F [1.9.22_1171]
Rating: 6.0/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 2 votes)

Webdriver Backed Selenium: use RC and WebDriver together

Today we have added full support for Webdriver-backed Selenium, which allows you to use the two API’s together in a single test.

By using this feature, it will be easier for you to migrate your existing Selenium RC tests to the new WebDriver format.
Here’s a list of reasons on why you should consider start using WebDriver:

  • Better and more consistent API
  • Improved emulation of user interactions. WebDriver uses native events in order to interact with a web page, where possible.
  • Support by the major browser vendors. Chrome, FireFox and Opera are all active contributors in WebDriver’s development
  • Faster, less error-prone tests
  • Even though not all RC commands are supported, you can now run most of your RC tests on a WebDriver instance inside our grid.
    An example of using the two API’s together in Ruby would be:

    #!/usr/bin/env ruby
    
    require "rubygems"
    require 'testingbot' 
    gem "selenium-client"
    gem "selenium-webdriver"
    require "selenium-webdriver" 
    require "selenium/client"
    
    selenium = Selenium::Client::Driver.new :host    => "hub.testingbot.com",
                                            :port    => 4444,
                                            :url     => "https://www.facebook.com",
                                            :browser => "*webdriver"
                                            
    caps = {
      :browserName => "iexplore",
      :platform => "WINDOWS"
    }
    urlhub = "http://API_KEY:API_SECRET@hub.testingbot.com:4444/wd/hub"
    client = Selenium::WebDriver::Remote::Http::Default.new
    client.timeout = 120
    
    
    @webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client
    selenium.start :driver => @webdriver
    puts @webdriver.title == selenium.title # WebDriver and RC together
    selenium.open "/" # RC
    @webdriver.quit # WebDriver
    

    This test will show up in our member area with screenshots/video and a list of steps from both RC and WebDriver.

    VN:F [1.9.22_1171]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Test TV – Live video stream of your tests running in the Cloud


Today we released a new feature in our TestingBot member area called Test TV.

With Test TV, you are now able to see your Selenium tests running in our Cloud.
A live video (secure VNC connection) will show your test running on any browser/mobile device straight from your test page.
When the test is completed, the live video will be stopped and will be replaced by a video recording of the test.

Test TV utilises HTML5 to show the live feed of your test which means it operates straight from inside your browser, no additional software is required.

To see it in action, log in to our member area and run a Selenium test. While the test is running, go to the test page. A video stream will appear where you will see your test running.

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: -1 (from 1 vote)