Skip to main content

Sauce Labs with Bamboo

Bamboo is Atlassian's client-side continuous integration platform. Use this documentation to manage your Sauce Labs tests within your Bamboo pipeline.

Installing the Plugin

  1. Download the Sauce OnDemand Plugin for Bamboo from the Atlassian Marketplace.
  2. From you Bamboo Administration page, go to the Plugins section and choose Plugin Manager.
  3. Search for sauce and then expand Bamboo Sauce OnDemand Plugin so you can click the Install button.
  4. After the installation completes, restart Bamboo and return to the Administration page.
  5. Under Communication, click Sauce OnDemand.
  6. Under Credentials, provide your SAUCE_USERNAME and SAUCE_ACCESS_KEY.

Setting a Different Data Center

You can set a different data center either globally, for all of your projects, or just for specific projects.


This configuration is supported in Bamboo OnDemand Plugin versions 1.6.87 or above.

Set Data Center Globally

  1. From your Bamboo home page, click the Setting icon in the top right corner.
  2. Select Global Variables.
  3. From the Communication menu, choose Sauce OnDemand.
  4. Enter your SAUCE_USERNAME and SAUCE_ACCESS_KEY and choose the applicable data center from the list.

Set Data Center for a Project

  1. In Bamboo, go to Build Dashboard > Project > Plan.
  2. Under Actions, choose Configure Plan.
  3. In the Stage tab, choose your desired job settings (typically Default Job).
  4. Select Miscellaneous.
  5. Enter your SAUCE_USERNAME and SAUCE_ACCESS_KEY and choose the applicable data center from the list.

Running Sauce Labs Tests in Bamboo

Sauce Labs supports a variety of project languages. Choose the set of instructions that matches the language for your pipeline.

Create a Plan

  1. In Bamboo, choose Create Plan and then Create New Plan.
  2. In the Plan Details section, for Project, select New Project and provide the following values in the fields:
    • Project Name: enter Sauce Demo.
    • Project Key: enter SAUCE.
    • Plan Name: enter Java or pytest, as applicable.
    • Plan Key: enter Demo.
  3. Under Source Repositories, choose Git.
  4. For Repository URL, enter the value that matches your plan:
    • Java:
    • pytest:
  5. For Branch, enter master.
  6. For Authentication Type, select None.
  7. Check Use shallow clones.

Configure Tasks

  1. Choose Configure Tasks, then Add Task.
  2. Select Maven 3.x.
  3. For Task Description enter Run Tests.
  4. Click Save.
  5. Click Create.

Configure the Plan

  1. Under Plan Configuration > Stages and Jobs > Default Stage, select Default Job.
  2. Click Miscellaneous.
  3. For Job Name, enter Default Job.
  4. Select Job Enabled.
  5. Click Save.

Enable the Sauce Plugin

  1. Select Enable Sauce OnDemand.
  2. In General Settings, select the Selenium version you want to use for your tests.
  3. Select the Browser you want to run your tests against.
  4. Enter the Max Duration, Idle Timeout, and Starting Browser URL settings for your test.
  5. Deselect the default Enable Sauce Connect setting if you do not need to launch a secure Sauce Connect Proxy instance in order to run your job (the instance will automatically close when the job completes).
  6. Click Save.

Run the Example Tests

  1. From the Bamboo dashboard, click the Enable icon.
  2. Click the Run icon.
  3. After the tests complete, click Sauce Jobs.
  4. Click the Job ID of any job to see the steps performed by the test as well as a test video.

Setting Environment Variables

Using environment variables in your configuration file allows you to maintain the values of properties in a single source and then reference them throughout all your jobs, ensuring that, if a modification needs to be made, it only needs to be made in one place in order to take effect in all references.


If you're using Protractor to run your tests with Bamboo, ensure disableEnvironmentOverrides is set to false in your config.ts file (this is the default setting) to prevent environment variables from being overridden by that file.

Sauce OnDemand Environment Variables

SELENIUM_HOSTThe hostname of the Selenium server
SELENIUM_PORTThe port of the Selenium server
SELENIUM_PLATFORMThe operating system of the selected browser
SELENIUM_VERSIONThe version number of the selected browser
SELENIUM_BROWSERThe name of the selected browser
SELENIUM_DRIVERContains the operating system, version and browser name of the selected browser
SELENIUM_URLThe initial URL to load when the test begins
SAUCE_USERNAMEThe user name used to invoke Sauce OnDemand
SAUCE_ACCESS_KEYThe access key for the user used to invoke Sauce OnDemand
SELENIUM_STARTING_URLThe value of the Starting URL field
SAUCE_ONDEMAND_BROWSERSA JSON-formatted string representing browsers you selected for the job configuration

Bamboo Environment Variables

Access Bamboo variables using ${bamboo.<variablename>} in configuration, or ${BAMBOO_<variablename>} in scripts.

SAUCE_BAMBOO_BUILDNUMBERThe build name to use with Sauce Labs jobs
TUNNEL_IDENTIFIERThe unique tunnel identifier used when Create a new unique Sauce Connect tunnel per build option is enabled

Outputting the Bamboo Session ID to stdout

As part of the post-build activities, the Sauce plugin parses the test result files to detect lines in the stdout or stderr containing the format:

SauceOnDemandSessionID=<session id> job-name=<job name>

To ensure that your test results and Sauce jobs are associated properly, output the SauceOnDemandSessionID (obtained from the RemoteWebDriver instance) to stdout using the following code.

private void printSessionId() {

String message = String.format("SauceOnDemandSessionID=%1$s job-name=%2$s",
(((RemoteWebDriver) driver).getSessionId()).toString(), "some job name");

We recognize that there are times we use words that are part of a troublesome history. We're working toward replacing these as part of the move to inclusive language within the tech community as a whole.