3

Trying to set up Azure Devops pipeline for test automation run (Java + Maven + Selenium) tests are running on Browserstack

To view Browser Stack Results I added two tasks BrowserStackConfig and BrowserStackResults to pipiline YAML file (according to instructions from BrowserStack)

But I am getting unexpected error on BrowserStackResults step : 'Build not found by name ..'

Error

Now I am trying to get results for "old" automation run on BS (Set BROWSERSTACK_BUILD_NAME to existing BS results = 20220114_666666)

Setup: Using Azure Devops with installed Browserstack extension

Steps:

  1. Prepared YML file

Prepared YML file

  1. Add pipeline for YML

  2. Run pipeline

Result:

BS Configuration step works

Config pass

Unexpected error on BrowserStackResults step "##[error] Build not found by name: "20220114_666666" error

James Z
  • 12,209
  • 10
  • 24
  • 44

2 Answers2

0

The following only fixes BrowserStackConfig task:

variables:
- name: BROWSERSTACK_BUILD_NAME
  value: "test-001"

But not for BrowserStackResults task. Is there another environment variable that controls the later? Or a list of variables used by browserstack?

Ales Potocnik Hahonina
  • 2,977
  • 2
  • 26
  • 32
0

According to the Browserstack Note: Ensure to set the build capability in your test script using the environment variable BROWSERSTACK_BUILD_NAME. The extension will fail to embed test reports in your pipeline if this capability is missing.

Set variables for BrowserStack Azure DevOps Extension

The BrowserStack Azure DevOps extension, by default, sets the following environment variables:

BROWSERSTACK_USERNAME
BROWSERSTACK_ACCESS_KEY
BROWSERSTACK_LOCAL
BROWSERSTACK_LOCAL_IDENTIFIER
BROWSERSTACK_BUILD_NAME

When you create a service connection, the BROWSERSTACK_USERNAME and the BROWSERSTACK_ACCESS_KEY are automatically added as variables during the configuration step.

The extension also adds the BROWSERSTACK_BUILD_NAME variable that autogenerates a build name for your test runs.

Edit your test script to call environment variables

Edit your test script to add the environment variables for setting capabilities using the following code snippets:

String buildName = System.getenv("BROWSERSTACK_BUILD_NAME");

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", buildName); // CI/CD job name using BROWSERSTACK_BUILD_NAME env variable

Seems you need to check your code if BROWSERSTACK_BUILD_NAME environment variable value is passed to buildName and added to capabilities. Otherwise, the report won't be generated