Bitbucket Integration

Applies to CrossBrowserTesting SaaS, last modified on January 10, 2023

This is an example of how you can use CrossBrowserTesting Automated Testing with Bitbucket pipelines to test a local development server. Python and Flask are used in this example but this can be done in a variety of languages and frameworks.

Bitbucket pipelines works by creating a Docker containers. Inside these containers you can run commands (like you might on a local machine) but with all the advantages of a fresh system, custom configured for your needs. To learn more about Docker containers you can go here: More about Docker Containers.


  1. Bitbucket account.

  2. This repository.

  3. CrossBrowserTesting username and authkey which can be found here: CrossBrowserTesting Credentials.


Setting up CrossBrowserTesting with Bitbucket pipelines is quite simple, we'll be up and running in a few quick steps!

  1. Start by creating a new repository for your project.

  2. Clone this repository:

    git clone

  3. Enable Bitbucket pipelines in your newly cloned repository. Go to: Settings > Pipelines Settings > Enable Pipelines.

  4. Add repository variables to your repo using your CrossBrowserTesting Credentials:

    • Go to: Settings > Pipelines Repository variable.

    • Add CrossBrowserTesting username: CBT_USERNAME | add_username_here.

    • Add CrossBrowserTesting authkey: CBT_AUTHKEY | add_authkey_here.

Repository variables input

Click the image to enlarge it.

Now every time you you push a commit the test will automatically start under the Pipelines tab.

Build configuration

image: python:3.7.3

    - step:
          - apt-get install unzip
          - pip install flask
          - pip install selenium
          - pip install requests
          - python /dev/null & #Start up webserver in background
          - bash ./local_connection.bash #Get local connection package from CBT
          - ./cbt_tunnels-linux-x64 --username $CBT_USERNAME --authkey $CBT_AUTHKEY --kill flag.txt /dev/null & #Start local connection
          - python #Run test to check webserver
          - bash ./kill_local_connection.bash #Kill local connection

Lets see what this is doing

  • We are creating a container with Python 3.7.3 installed.

  • Next we get the required packages that we need:

    • Unzip (Used to unzip local connection package from CrossBrowserTesting).

    • Flask (Simple webserver).

    • Selenium (Create webdriver for automation testing).

    • Requests (Send HTTP requests to CrossBrowserTesting).

  • We spin up a Flask server on port 5000.

  • We get the local connection package from CrossBrowserTesting and run it using our credentials. Local Connection Service.

  • We run a simple test to connect to the website and check the page title.

  • Finally we create the flag.txt file to then kill the local connection.

See Also


Highlight search results