We're here to help

Generating the build.xml file for Docker

Ensure that you have installed Java 1.8 or later and ANT 1.9.0 or later prior to completing the steps below.

To generate the Build.xml, we recommend using Run Under ANT on a machine which has Provar installed, then you can customize the file to run inside the Docker container. Refer to the samplefile below for an example of a build file configured for use without Provar installed.

<project default="runtests">
    <property environment="env"/>
    <property name="provar.home" value="${env.PROVAR_HOME}"/>
    <property name="testproject.home" value="${env.WORKSPACE}"/>
    <property name="testproject.results" value="${env.WORKSPACE}/ANT/Results"/>
    <property name="secrets.password" value="${env.ProvarSecretsPassword}"/>
    <property name="testenvironment.secretspassword" value="${env.ProvarSecretsPassword_EnvName}"/>
     
    <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"/>
    <taskdef name="Test-Cycle-Report" classname="com.provar.testrunner.ant.TestCycleReportTask" 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}"/>
​
        <Run-Test-Case provarHome="${provar.home}" 
                projectPath="${testproject.home}" 
                resultsPath="${testproject.results}" 
                resultsPathDisposition="Increment" 
                testEnvironment="" 
                webBrowser="Chrome_Headless" 
                webBrowserConfiguration="Full Screen"
                webBrowserProviderName="Desktop"
                webBrowserDeviceName="Full Screen" 
                excludeCallableTestCases="false" 
                salesforceMetadataCache="Reload" 
                projectCachePath="${testproject.home}/../.provarCaches"
                testOutputlevel="WARNING" 
                pluginOutputlevel="WARNING"
                stopTestRunOnError="false"                
                secretsPassword="${secrets.password}"
                testEnvironmentSecretsPassword="${testenvironment.secretspassword}"
                invokeTestRunMonitor="true"
                >
            <fileset dir="${testproject.home}/tests"/>
        </Run-Test-Case>
    </target>
</project>

 

The three main property tags that need to be reconfigured are provar.home, testproject.home and testproject.results:

  • provar.home contains the location where the Provar installation was unzipped to.
    • Since we are using a Docker container, this value must be set to ${env.PROJECT_HOME}
  • testproject.home is the folder that contains the Test Project .testproject file.
    • This value must be set to ${env.WORKSPACE}
  • testproject.results is where the test run’s results should be written.
    • This value must be set to ${env.WORKSPACE}/ANT/Results