Skip to main content

Significance of Build Names

This document guides you with the various benefits of using the BrowserStack Automate “build” capability.

Introduction

The build capability allows you to logically group your Selenium tests, provides you with information on how you can improve the speed of test suite execution, analyze and explore the test data in a more coherent manner.

Organizing your Tests

Using the build capability, you will be able to properly organize your tests. For example, if you are working on your new marketing website, and want to run your test suite for the Alpha 0.1.7 build, you can pass the following capabilities:

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("build", "alpha_0.1.7");
caps.setCapability("name", "Home page must have a title");
var capabilities = {
 'build' : 'alpha_0.1.7',
 'name' : 'Home page must have a title'
}
// For Chrome browser
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Home page must have a title", true);

// For Edge browser
OpenQA.Selenium.Edge.EdgeOptions capability = new OpenQA.Selenium.Edge.EdgeOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Home page must have a title", true);

// For IE browser
OpenQA.Selenium.IE.InternetExplorerOptions capability = new OpenQA.Selenium.IE.InternetExplorerOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Home page must have a title", true);

// For Firefox browser
OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Home page must have a title", true);
$caps = array(
   "build" => "alpha_0.1.7",
   "name" => "Home page must have a title",
 );
capabilities = {
 "build" : "alpha_0.1.7",
 "name" : "Home page must have a title"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['build'] = 'alpha_0.1.7'
caps['name'] = 'Home page must have a title'

When you run the next test within the same test suite, just update the test name and it is grouped automatically into the same build.

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("build", "alpha_0.1.7");
caps.setCapability("name", "Admin page access must be denied");
var capabilities = {
 'build' : 'alpha_0.1.7',
 'name' : 'Admin page access must be denied'
}
// For Chrome browser
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Admin page access must be denied", true);

// For Edge browser
OpenQA.Selenium.Edge.EdgeOptions capability = new OpenQA.Selenium.Edge.EdgeOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Admin page access must be denied", true);

// For IE browser
OpenQA.Selenium.IE.InternetExplorerOptions capability = new OpenQA.Selenium.IE.InternetExplorerOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Admin page access must be denied", true);

// For Firefox browser
OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
capability.AddAdditionalCapability("build", "alpha_0.1.7", true);
capability.AddAdditionalCapability("name", "Admin page access must be denied", true);
$caps = array(
   "build" => "alpha_0.1.7",
   "name" => "Admin page access must be denied",
 );
capabilities = {
 "build" : "alpha_0.1.7",
 "name" : "Admin page access must be denied"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['build'] = 'alpha_0.1.7'
caps['name'] = 'Admin page access must be denied'

If you use the build capability, you will find the execution of tests within the build on the BrowserStack Automate dashboard, as shown in the following figure. Also, it becomes very easy to find your tests within the build. Organized test with build names

In the above figure, annotated areas represent the following:

1 - List of all builds 2 - List of all test sessions within the selected build 3 - Detailed view of the selected session along with video and logs

Setting build names through CI/CD tool (applicable without CI/CD tool as well)

While running a job through a CI/CD tool, the job is executed as a separate build on BrowserStack Automate. You can set the build name as mentioned in the following steps:

  • Set an environment variable (for example, BROWSERSTACK_BUILD_NAME) with name of the build as the value. You have to set a new value in the environment variable in a pre-build step that you can configure in your CI/CD tool, to ensure the value of the environment variable is different on every build execution.
  • Use this environment variable in the test scripts that are part of the build.
String build_name = System.getenv("BROWSERSTACK_BUILD_NAME"); //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("build_name", build_name); // CI/CD job or build name
build_name=process.env.BROWSERSTACK_BUILD_NAME //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
var capabilities = {
  'build': build_name // CI/CD job or build name
}
// For Chrome browser
string build_name = Environment.GetEnvironmentVariable("BROWSERSTACK_BUILD_NAME"); //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
OpenQA.Selenium.Chrome.ChromeOptions capability = new OpenQA.Selenium.Chrome.ChromeOptions();
capability.AddAdditionalCapability("build", build_name, true);

// For Edge browser
string build_name = Environment.GetEnvironmentVariable("BROWSERSTACK_BUILD_NAME"); //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
OpenQA.Selenium.Edge.EdgeOptions capability = new OpenQA.Selenium.Edge.EdgeOptions();
capability.AddAdditionalCapability("build", build_name, true);

// For IE browser
string build_name = Environment.GetEnvironmentVariable("BROWSERSTACK_BUILD_NAME"); //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
OpenQA.Selenium.IE.InternetExplorerOptions capability = new OpenQA.Selenium.IE.InternetExplorerOptions();
capability.AddAdditionalCapability("build", build_name, true);

// For Firefox browser
string build_name = Environment.GetEnvironmentVariable("BROWSERSTACK_BUILD_NAME"); //BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
OpenQA.Selenium.Firefox.FirefoxOptions capability = new OpenQA.Selenium.Firefox.FirefoxOptions();
capability.AddAdditionalCapability("build", build_name, true);
$build_name=$_SERVER["BROWSERSTACK_BUILD_NAME"] #BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
$caps = array(
  "build" => $build_name // CI/CD job or build name
);
build_name=os.getenv("BROWSERSTACK_BUILD_NAME") #BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
desired_cap = {
  'build': build_name # CI/CD job or build name
}
build_name=ENV['BROWSERSTACK_BUILD_NAME'] #BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['build'] = build_name # CI/CD job or build name
$build_name =  $ENV{'BROWSERSTACK_BUILD_NAME'}; #BROWSERSTACK_BUILD_NAME is the sample environment variable. Ensure the value of this variable is set every time before a build is run. You can do that by adding a pre-build step
my $extraCaps = {
  'build' => $build_name # CI/CD job or build name
};
  • Run the job from the CI/CD tool, this will execute a build with the value of environment variable (Step 1) as the build name on Automate dashboard.

To know more about BrowserStack integration with CI/CD tools, refer the INTEGRATE WITH CI/CD TOOLS section on the left sidebar.

Improving the speed of build execution

On BrowserStack, you can run multiple tests simultaneously across various browser, device, and OS combinations. This is parallel testing. It helps you reduce your test suite’s run time, resulting in faster builds and releases. This will help in faster and frequent releases, improve automation coverage without worrying about the wait time, and reduce developer frustration with faster feedback loops.

If you use the build capability then it will allow us to analyze your build’s execution time. We will then be able to suggest the right number of parallels that you should be using, for improving the speed of execution of your builds as shown in the following figure:

Analyze build execution time to suggest right number of parallels

Analytics about your test suites

Using the build capability you can utilize BrowserStack Enterprise’s Test Insights feature. Test Insights allows the admin to evaluate the performance of automation testing across the organization. It provides information about the tests that are run by various account users. It also allows to filter analytics by teams, builds, error rates, device and browser coverage to give out meaningful data about your tests as shown in the following figure:

Image of Filters like timerange,user,build,os,etc. available under Automate Test Insights when Test Stability is selected

Learn more about Test Insights for analyzing and exploring your test data.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert