Bitbucket Pipelines WebDriver Testing

Bitbucket Pipelines makes it very easy to do Continuous Integration.

You can configure Bitbucket Pipelines by adding a bitbucket-pipelines.yml file to the root of your repository.

See our full Bitbucket Pipelines example to see how easy it is to use TestingBot with Bitbucket Pipelines.


1. Go to your Bitbucket repository settings and add the following environment variables:

TB_KEY: Your TestingBot Key
TB_SECRET: Your TestingBot Secret

2. Configure bitbucket-pipelines.yml with the example configuration below:

image: ruby:2.1
    - step:
          - apt-get update
          - apt-get install unzip
          - bundle install
          - bundle exec rackup -p 8001 > /dev/null &
          - ./run_local.bash
          - bundle exec rspec spec/welcome.rb
          - pkill -9 rackup

The run_local.bash script will download our TestingBot Tunnel

#!/bin/bash -e

java -jar testingbot-tunnel.jar ${TB_KEY} ${TB_SECRET} > /dev/null &
sleep 10

3. Read the Bitbucket environment variables in your test. For example, with RSpec:

require 'selenium-webdriver'
require 'rspec'

RSpec.configure do |config| config.color_enabled = true end

describe "The welcome demo" do

  before(:all) do
    testingbot_key = ENV['TB_KEY']
    testingbot_secret = ENV['TB_SECRET']
    caps =
    caps['platform'] = 'WINDOWS'
    caps['version'] = 'latest'
    caps['browserName'] = 'chrome'
    caps['build'] = 'Bitbucket Pipeline'
    caps['name'] =  'Bitbucket Pipeline'
    @driver = Selenium::WebDriver.for(:remote, :url => "https://#{testingbot_key}:#{testingbot_secret}", :desired_capabilities => caps)

  after(:all) do

  it "should have a welcome page" do
    username = 'Test User'
    @driver.get 'http://localhost:8001'
    @driver.find_element(:name ,'name').send_keys username
    @driver.find_element(:css, "input[type='submit']").click
    actual_text = @driver.find_element(:css, "h2").text
    actual_text.should == "Welcome, #{username}"


Looking for More Help?

Have questions or need more information?
You can reach us via the following channels: