Search⌘ K

Change Pipeline Variable at Run Time

Explore how to modify pipeline variables at runtime in Azure DevOps to run Selenium Java tests with different settings. This lesson helps you enable user overrides on variables for flexible and efficient automated test execution using YAML pipelines.

Instead of hard-coding the priority value in the Maven goals, we use the $(Priority) variable:

YAML
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'clean test -Dgroups=$(Priority)' <--------------------

But if we want to run the tests that belong to the Medium group instead of High, we have to change the Priority pipeline variable value from High to Medium and re-save the ...