Search⌘ K
AI Features

Run Jobs in Parallel

Explore how to run Selenium Java test jobs in parallel within Azure DevOps pipelines. Understand how adjusting the maxParallel setting enables multiple jobs to execute simultaneously, reducing overall execution time. Practice configuring parallel pipelines to improve test efficiency.

We'll cover the following...

To run the jobs from the previous lesson in parallel, we just change the maxParallel value from 1 to 3:

YAML
trigger:
- master
jobs:
- job:
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Tests_High:
TestsPriority: "High"
Tests_Medium:
TestsPriority: "Medium"
Tests_Low:
TestsPriority: "Low"
maxParallel: 3 <-----------
steps:
- task: Bash@3
displayName: "create browser variable"
inputs:
targetType: 'inline'
script: |
export BROWSER=$(BROWSER)
- 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=$(TestsPriority)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Log File as Artifact'
inputs:
PathtoPublish: $(System.DefaultWorkingDirectory)/target/logs
ArtifactName: 'logs_$(TestsPriority)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Screenshots as Artifact'
inputs:
PathtoPublish: $(System.DefaultWorkingDirectory)/target/screenshots
ArtifactName: 'screenshots_$(TestsPriority)'

As soon as the pipeline starts executing, you should be able to see the three job runs happening at the same time:

The execution time of the parallel ...