Features

Circle CI Automated Testing

Circle CI is a continuous integration service in the cloud.

It is very easy to use the TestingBot Selenium grid together with Circle CI.


Below are the steps to run your Selenium tests via Circle CI, once the tests are up and running you can even display a TestingBot Status badge showcasing your Selenium tests status.

Get Circle CI up and running

Sign up at Circle CI and connect your project with Circle CI.

We recommend setting up environment variables on the project settings page of CircleCI.
You can set up the TB_KEY and TB_SECRET variables there, so that they are not publicly visible.

Example circle.yml file:
version: 2.1
orbs:
  ruby: circleci/ruby@1.4.0
  node: circleci/node@2

jobs:
  test:
    parallelism: 3 # depends on how many concurrent sessions your TestingBot subscription has
    docker:
      - image: cimg/ruby:2.7-node
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD  # context / project UI env-var reference
    environment:
      SELENIUM_HOST: hub.testingbot.com
			SELENIUM_PORT: 80
			TB_AUTOMATE_BUILD: "build No. $CIRCLE_BUILD_NUM for circleCI"
			SELENIUM_PLATFORM: WINDOWS
			SELENIUM_BROWSER: Chrome
			SELENIUM_BROWSER_VERSION: "latest"
    steps:
      - checkout
      - ruby/install:
          version: '2.7'
      - ruby/install-deps
      - bundle exec cucumber

workflows:
  version: 2
  test:
    jobs:
      - test:


You can now use the environment variables, defined above and on CircleCI, in your code:


require 'selenium/webdriver'

url = "http://#{ENV['TB_KEY']}:#{ENV['TB_SECRET']}@hub.testingbot.com/wd/hub"

capabilities = Selenium::WebDriver::Remote::Capabilities.new

capabilities['build'] = ENV['TB_AUTOMATE_BUILD'] if ENV['TB_AUTOMATE_BUILD']
capabilities['platform'] = ENV['SELENIUM_PLATFORM'] || 'ANY'
capabilities['browserName'] = ENV['SELENIUM_BROWSER'] || 'chrome'
capabilities['version'] = ENV['SELENIUM_BROWSER_VERSION'] if ENV['SELENIUM_BROWSER_VERSION']

browser = Selenium::WebDriver.for(:remote, :url => url, :desired_capabilities => capabilities)

Before do |scenario|
    @browser = browser
end

at_exit do
    browser.quit
end