The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing


External Resources

More Info

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

By assigning unique attributes (e.g., test name, tags, and build ID) in your test capabilities, you can then apply these annotations to filter results on your Sauce Labs Test Results and Archive pages. Although not required, following this best practice can make it easier to monitor tests and builds in your CI pipeline.

You can set these capabilities to be any combination of letters and numbers. To differentiate between builds, it's also a good practice to add a timestamp or CI job/build number at the end of your build tag.

See the following sections for more information: 


While it's technically possible to use the same build name for multiple test runs, this will cause all of your test results to appear incorrectly as part of a single run. This, in turn, will cause your test results for those builds to be inaccurate.

Code Examples: Build, Tags, and Name

Build, Tags, Name Example for Java
String username = System.getenv("SAUCE_USERNAME");
String accessKey = System.getenv("SAUCE_ACCESS_KEY");
MutableCapabilities sauceOptions = new MutableCapabilities();
sauceOptions.setCapability("name", "Web Driver demo Test");
sauceOptions.setCapability("tags", "tag1");
sauceOptions.setCapability("build", "build-1234");
sauceOptions.setCapability("username", username);
sauceOptions.setCapability("accessKey", accessKey);

FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setCapability("platformName", "Windows 10");
firefoxOptions.setCapability("browserVersion", "79.0");
firefoxOptions.setCapability("sauce:options", sauceOptions);
WebDriver driver = new RemoteWebDriver(
new URL(""),
Build, Tags, Name Example for C#
string _sauceUsername = Environment.GetEnvironmentVariable("SAUCE_USERNAME", EnvironmentVariableTarget.User);
string _sauceAccessKey = = Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY", EnvironmentVariableTarget.User);
var sauceOptions = new Dictionary<string, object>
	["username"] = _sauceUsername,
	["accessKey"] = _sauceAccessKey,
	["name"] = "Web Driver demo Test",
	["build"] = "build-1234",
	["tags"] = "tag1"
var firefoxOptions = new FirefoxOptions()
	BrowserVersion = "79.0",
	PlatformName = "Windows 10",
	UseSpecCompliantProtocol = true
firefoxOptions.AddAdditionalCapability("sauce:options", sauceOptions, true);
IWebDriver driver = new RemoteWebDriver(new Uri(""),
            	firefoxOptions.ToCapabilities(), TimeSpan.FromSeconds(600));
Build, Tags, Name Example for JavaScript
const username = process.env.SAUCE_USERNAME;
const accessKey = process.env.SAUCE_ACCESS_KEY;
const tags = ["tag1", "tag2", "tag3" ]
const driver = new webdriver.Builder()
      'browserName': 'firefox',
      'platform': 'Windows 10',
      'version': '79.0',
      'sauce:options': {
          'name': 'Web Driver demo Test',
          'build': 'build-1234',
          'tags': tags,
          'username': username,
          'accessKey': accessKey
    .usingServer("https://" + username + ":" + accessKey +
Build, Tags, Name Example for Python
sauce_username = os.environ["SAUCE_USERNAME"]
sauce_access_key = os.environ["SAUCE_ACCESS_KEY"]
sauceOptions = {
    "build": "build-1234",
    “name”: “Web Driver demo Test”,
    “tags”: [ "tag1", "tag2", "tag3" ]
browserOptions =  {
    'platformName':"Windows 10",
    'browserName': "firefox",
    'browserVersion': '79.0',
     'sauce:options': sauceOptions
browser = webdriver.Remote(“”, desired_capabilities=browserOptions)
Build, Tags, Name Example for Ruby
caps = {
	browser_name: 'firefox',
	platform_name: 'windows 10',
	browser_version: '79.0',
	"sauce:options" => {
    	name: 'Web Driver demo Test',
    	build: 'build-1234',
    	tags: 'tag1',
    	username: ENV['SAUCE_USERNAME'],
    	access_key: ENV['SAUCE_ACCESS_KEY']
driver = Selenium::WebDriver.for(:remote,
	url: '',
	desired_capabilities: caps)

Video: Organize Tests by Build

This video shows you how you can associate your tests with Builds in Sauce Labs, making it easier to understand how your tests are performing within your CI pipeline.

More Information