Search⌘ K

Read the browser name from a pipeline variable

Understand how to create and use pipeline variables in Azure DevOps to dynamically set the browser name for Selenium Java test execution. This lesson guides you through managing variables efficiently to run tests on different browsers without modifying pipeline code.

It is not efficient to have the browser name hard-coded in the pipeline YAML code as follows:

YAML
- task: Bash@3
inputs:
targetType: 'inline'
script: 'export BROWSER=chrome'

Hard-coding the value in the YAML code means that we will have to change the code when we decide to run the tests on a different browser such as Firefox or Edge.

Instead, we should create a pipeline variable and use its value for the environment variable.

Create the pipeline variable

  1. In the pipeline ...