Features
< Back to Blog Overview

Record videos of your Selenium tests

2012-01-20
Video Record your Selenium Tests
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

When a Selenium test fails, you usually get a clear error message or trace to indicate where the problem is located. A video of your Selenium test will offer even more help in finding out just why your Selenium test failed. By video-recording your Selenium test, you can track down when and where a problem occurs.


At TestingBot video record every Selenium test on our grid. When a test fails, you can log into our member area, click the failed test and see a video of your test. This video is also available through our API, so you can easily integrate this feature into your Continuous Integration system.


Together with a video, we also take a full-screen screenshot of every single step in your test. This provides for another method to examine your tests. These screenshots are available in our member area or by accessing our API.


It's important to note that video recording your test does not slow down the execution of your test. We use the Windows built-in screen recording capabilities, which uses very little CPU.


The video is recorded into a MP4 file.

Below is a Ruby code example of running a test and grabbing the video and screenshots from our API.

Copy code
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 => 4444,
        :browser => "iexplore",
        :version => "9",
        :platform => "WINDOWS",
        :url => "http://testingbot.com",
        :timeout_in_second => 60

    browser.start_new_browser_session
  end

  def teardown
    browser.close_current_browser_session
  end

  def test_page_open
    browser.open "/"
    p browser.session_id
  end
end

This code will return a String with the session_id of the test (a unique identifier for the test). For example, the session_id we receive is: 7f5br7939150a9f199d2215920403e83


You can then query our API to fetch the video and screenshots of this test: curl -u key:secret https://api.testingbot.com/v1/tests/7f5br7939150a9f199d2215920403e83


This call will return a JSON formatted string with the following data:

Copy code
{
  "created_at":"2012-01-20T23:21:23Z",
  "extra":null,
  "id":121453,
  "name":"ExampleTest::test_page_open",
  "session_id":"7f5br7939150a9f199d2215920403e83",
  "status_message":"OK",
  "success":true,
  "thumbs":["https://s3.amazonaws.com/thumbtestingbot/7f5br7939150a.jpg"],
  "video":"https://s3.amazonaws.com/rectestingbot/7f5br7939150a.mp4",
  "browser":"IE9",
  "os":"WINDOWS"
}

The response contains the video URL (https://s3.amazonaws.com/rectestingbot/7f5br7939150a.mp4) and the thumbnails of every step in your test.


This is just one example call to our API, for more information, please consult our API guide.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Mobile Testing with Selenium and Android Ice Cream Sandwich

Today we've added Android to our Selenium grid, which means you can now use our grid for mobile testing as well. We've hooked up an Android Ice C...

Read more
Receive SMS alerts when a Selenium test fails

Today we've added SMS support to our alert options. If a test fails, we can now alert you via e-mail, push notification and SMS.

Read more
Selenium automated browser testing with C# and NUnit.

In this blog post we'll highlight how easy it is to start testing websites with .NET framework 4 or .NET framework 3 and C#. NUnit is built for all...

Read more
Selenium 2.16.1, ChromeDriver 18.0.995.0 and C# with NUnit

We are pleased to announce that we have updated our Selenium grid to the latest Selenium version, 2.16.1 Changes include improved stability and b...

Read more
blank

Today we've added SSL support to our Selenium grid, you can now test HTTPs pages without problems. Self-signed and regular SSL certificates should ...

Read more
blank

In this blogpost we'll talk about creating your first Selenium test, running the test on your own computer and then later run it on several browser...

Read more