Features
< Back to Blog Overview

Travis CI Selenium testing with TestingBot

2012-12-31
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

Travis CI is a continuous integration service, you can use this free service to run (Selenium) tests from your GitHub repository. It is very easy to use the TestingBot Selenium grid together with Travis CI.

Below is a guide to run your Selenium tests with Travis CI. We offer TestingBot status badges to indicate your Selenium tests status on your GitHub pages.

Set up Travis CI

Sign up at Travis CI and connect your GitHub project with Travis CI. You can find information on how to do this at the Travis CI help section.

Sample Selenium Test

Add a simple Selenium test to your GitHub project, modify the .travis.yml file in your repository to indicate you want to run a Selenium test.

language: node_js
node_js:
  - 0.8
env:
- [
    {secure: "akuE0dld1Ke9mahjUUrQhUZRYWasdfewfwefewfZlbvOx\nqaPybirPGsDmImvcktaAkjLxpePd0V1+ak+4dws7dTrFfEsdvsdsdvsdvds2\nud1q5oGOzEqfiRGxY/fJHLWlaQ609Bsdfdsfds2VeY1Z/V7N9iQ="},
    {secure: "JGfkAfr/SOlzV+NpgNi3fxP4F2usdfdsveGAppugHj1IxhoyjY\nOp07x4p1hdIfWVF03RqUrPNXkl72+yh53pv2fUzsdfsd3434GRjGy6J6\notuA/N+xs0+TP2ENlCmDauwO32Okfojvj7CgvsdfdsfRyaFzIGWPdw="}
  ]
script:
- "node tests/examples/*.js"

The two secure lines in the above example are your TestingBot key and secret, which are used to run a test on our TestingBot Selenium Grid. To generate these 2 lines, you need to install the Travis CI gem and run these commands with your own key and secret:

travis encrypt username/projectname TESTINGBOT_KEY=key
travis encrypt username/projectname TESTINGBOT_SECRET=secret

Now you can use the encrypted TESTINGBOT_KEY and TESTINGBOT_SECRET environment variables in your tests. Remember to indicate your test's privacy setting as public (privacy = true) if you want to use the test status badges we provide.


Here's an example in NodeJS:

var webdriverjs = require('tbwdjs');
var client = webdriverjs.remote({
    host: 'hub.testingbot.com',
    desiredCapabilities: {
        browserName: 'internet explorer',
        version: 9,
        platform: 'WINDOWS',
        api_key: process.env.TESTINGBOT_KEY,
        api_secret: process.env.TESTINGBOT_SECRET,
        name: (process.env.TRAVIS_JOB_ID ? ("Travis Build " + process.env.TRAVIS_JOB_ID) : "Simple Test"),
        privacy: true
    }
});

client
    .testMode()
    .init()
    .url('http://google.com/')
    .titleEquals('Google')
    .end();

Get your TestingBot badge

Once your first Selenium test has ran via Travis, you can start displaying its status with our Status Badges:
<a href="https://testingbot.com/u/key">
  <img src="https://testingbot.com/buildstatus/key" alt="Selenium Test Status">
</a>

More information

Our help page regarding Travis CI integration has more info: Travis CI + TestingBot

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Windows 8/Windows 2012 Selenium Testing

Today we have added Windows 2012 (= Windows 8) VMs to our grid. You can now run Firefox/Chrome and IE10 tests on Windows 2012 VMs.

Read more
Selenium testing with Internet Explorer 10 (IE10)

Today we have added IE10 to our Selenium grid. You can now run WebDriver and Selenium RC tests against Microsoft's latest Internet Explorer br...

Read more
OS X Testing with Selenium WebDriver

Currently we are the only company providing OS X support to our customers. When you run a test on one of our Mac nodes, we reserve a dedicated...

Read more