The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

You can add identifying information such as a name, tags, and build numbers in the desired capabilities for your test. You can use these annotations to filter results on your Sauce Labs Test Results and Archive pages, and keep track of builds in your CI pipeline. 

Build, Tags, Name Example for Java
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability("platform", "Windows XP");
caps.setCapability("version", "37.0");
caps.setCapability("name", "Web Driver demo Test");
caps.setCapability("tags", "Tag1");
caps.setCapability("build", "build-1234");
WebDriver driver = new RemoteWebDriver(
new URL("http://YOUR_USERNAME:YOUR_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub"),
    caps);
Python Example Build
desired_cap = {
    'platform': "Mac OS X 10.9",
    'browserName': "chrome",
    'version': "31",
    'build': "build-1234"
} 
Python Example Tags
desired_cap = {
    'platform': "Mac OS X 10.9",
    'browserName': "chrome",
    'version': "31",
    'build': "build-1234",
    'tags': [ "tag1", "tag2", "tag3" ]
}

NOTE: While it is technically possible to use the same build name for multiple runs, this will cause all results in Sauce Labs to incorrectly appear as part of a single run, which will cause your test results for those builds to be inaccurate. Sauce Labs recommends using a time stamp or a CI job/build number at the end of your build tag in order to differentiate between builds, for example:

caps.setCapability("build", "build: " + System.getenv("BUILD_TAG"));
caps.SetCapability("build", "build: " + System.Environment.getEnvironmentVariable("BUILD_TAG"));
build: 'build: ' + process.env.BUILD_TAG,
'build': 'build: ' + os.environ["BUILD_TAG"],
build: 'build: ' + ENV['BUILD_TAG'],