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