Documentation

Looking for something in particular?

Parallel Testing using Build.xml

This support article describes configuring the parallel execution in the ANT’s Build.xml file. Parallel execution is configured by adding a parallel tag in Build.xml.

Steps to execute test cases in parallel using ANT

In the example below, we will see how to execute two Test Plans in parallel.

Step 1: Once the test plan(s) are created, export these to Build.xml. Right-click on the test plan and select Export as ANT build file.

Above: Exporting Test Plan to Build.xml by selecting Export as ANT build file. 

An Export as ANT build file screen is displayed.

Above: Screenshot of Export as ANT build file. 

Step 3. Click Export. 

A Build.xml file is created in the [PROJECT]/ANT folder.

Step 4. We modified the Build.xml file to incorporate the parallel execution. We used ANT’s parallel tag under which we defined our Run Tasks. All Run Tasks will be executed in parallel in the same way as given below.

<parallel>
    <Run-Test-Case ……>
    </Run-Test-Case>


<Run-Test-Case ……>
    </Run-Test-Case>


<Run-Test-Case ……>
    </Run-Test-Case>


</parallel>

In the Build.xml file given below, we have two test plans Smoke and Regression that are available under different Run-Test-Case tags; which are inside a parallel tag so that the test plans are executed in parallel. 

Note: Each <fileset> tag must contain the path of the test plan you want to execute in parallel.

<project default="runtests">
    <property name="version" value="2.221.13.0"/>
    <property environment="env"/>
    <property name="provar.home" value="C:/Program Files/Provar2.2.1.06/"/>
    <property name="testproject.home" value=".."/>
    <property name="testproject.results" value="../ANT/Results"/>
    <property name="secrets.password" value="${env.ProvarSecretsPassword}"/>


    <taskdef name="Provar-Compile" classname="com.provar.testrunner.ant.CompileTask" classpath="${provar.home}/ant/ant-provar.jar"/>
    <taskdef name="Run-Test-Case" classname="com.provar.testrunner.ant.RunnerTask" classpath="${provar.home}/ant/ant-provar.jar;${provar.home}/ant/ant-provar-bundled.jar;${provar.home}/ant/ant-provar-sf.jar"/>
    
    <target name="runtests">
    
        <Provar-Compile provarHome="${provar.home}" projectPath="${testproject.home}"/>
    <parallel>
        <Run-Test-Case provarHome="${provar.home}" 
                        projectPath="${testproject.home}" 
                        resultsPath="${testproject.results}" 
                        resultsPathDisposition="Increment" 
                        testEnvironment="" 
                        webBrowser="Chrome" 
                        webBrowserConfiguration="Full Screen"
                        webBrowserProviderName="Desktop"
                        webBrowserDeviceName="Full Screen" 
                        salesforceMetadataCache="Reuse" 
                        projectCachePath="../.provarCaches"
                        testOutputlevel="BASIC" 
                        pluginOutputlevel="WARNING"
                        stopTestRunOnError="false"
                        secretsPassword="${secrets.password}"
                >
                    <fileset id="testplan" dir="../plans/Smoke"></fileset>
                    <planFeature name="PDF" type="OUTPUT" enabled="true"/>
                    <planFeature name="PIECHART" type="OUTPUT" enabled="true"/>
                    <planFeature name="EMAIL" type="NOTIFICATION" enabled="true"/>


                </Run-Test-Case>
        
        <Run-Test-Case provarHome="${provar.home}" 
                        projectPath="${testproject.home}" 
                        resultsPath="${testproject.results}" 
                        resultsPathDisposition="Increment" 
                        testEnvironment="" 
                        webBrowser="Chrome" 
                        webBrowserConfiguration="Full Screen"
                        webBrowserProviderName="Desktop"
                        webBrowserDeviceName="Full Screen" 
                        salesforceMetadataCache="Reuse" 
                        projectCachePath="../.provarCaches"
                        testOutputlevel="BASIC" 
                        pluginOutputlevel="WARNING"
                        stopTestRunOnError="false"
                        secretsPassword="${secrets.password}"
                >
            <fileset id="testplan" dir="../plans/Regression"></fileset>
                    <planFeature name="PDF" type="OUTPUT" enabled="true"/>
                    <planFeature name="PIECHART" type="OUTPUT" enabled="true"/>
                    <planFeature name="EMAIL" type="NOTIFICATION" enabled="true"/>


                </Run-Test-Case>
    </parallel>
        
    </target>


</project>

Feedback

Was this article helpful for you?
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top