We're here to help

Parallel execution in Microsoft Azure Pipelines using multiple build.xml files

Microsoft Azure Pipelines is a cloud service that you can use to automatically build and test your code project and make it available to other users. It works with just about any language or project type.

Azure Pipelines combines continuous integration (CI) and continuous delivery (CD) to constantly and consistently test and build your code and ship it to any target.

This support article describes how to execute parallel execution in Azure Pipelines using multiple build.xml files. 

You can divide the test cases that you need to execute into multiple suites and each suite can be part of a build.xml file. In this example, we are using 20 test cases with two build.xml files with 10 different test cases associated with each.

To get started, you will need to make the following changes to the provar.home and testproject.home variables to include path of the agent system.

 

Step 1: Make the following configuration changes in the Azure Pipelines. You will configure Azure Pipelines with an ANT task. To get started, click Variables.

Step 2: Create a variable BUILDFILE with the value as:

Build1.xml,build2.xml

Note: The value is the name of different build files created above. It could be different for you.

Step 3: Click Tasks and then the agent job. 

Step 4: Under Parallelism select Multi-Configuration.

Step 5: Complete the confirmation using the following configuration information. 

Multipliers: BUILDFILE

(Note: This is the variable name being defined at Step 3.)

Maximum number of agents: Provide the number of agents you want to execute test cases in parallel.

Step 6: Select the ANT task.

Step 7: Complete the confirmation using the following configuration information. 

  • ANT build file: <Path to build file>\$(BUILDFILE)
  • Check Publish to Azure Pipelines under JUnit Test Results
  • Test results files: <Path to Result file from build.xml>\junit.xml

Step 8: Changes can also be made to the build.xml files to create separate result files. (See command below.) Otherwise, the result of one agent will override the result of the other.

<property name=”testproject.results” value=”D:\a\1\s\ANT\Results\${env.BUILDFILE}”/>

Step 9: If you execute Azure Pipelines now, you should see two agents running – each executing their respective build file.