We're here to help

Salesforce DX Integration

Provar now supports integration with Salesforce DX. Provar and Salesforce DX can be used together to generate a Scratch Org, push latest Salesforce customization, then run Provar tests inside the Scratch Org to get functional testing insights.

Prerequisites

The following prerequisites need to be completed before setup.

  1. Scratch Org need to be set up.
  2. Password should be generated for the Scratch Org.
  3. Scratch org alias should be same as the Salesforce org username.
  4. Salesforce DX project should be authenticated on the machine where Provar is installed.

 

Setup

To support Salesforce DX in Provar, it is necessary to add a new ANT Task after generating the Build File. This ANT Task will create a test environment and add the necessary Connection Overrides to run Provar against a Scratch Org. Use this task prior to the Provar Runner Task to create/update the environment.

You can then copy and paste the following into the Build File, adding your own information where shown.

<taskdef name="Provar-ConfigureDx" classname="com.provar.testrunner.ant.ConfigureDxTask" classpath="${provar.home}/ant/ant-provar.jar;${provar.home}/ant/ant-provar-bundled.jar;${provar.home}/ant/ant-provar-sf.jar"/>

<Provar-ConfigureDx testEnvironment="<env-name>" provarHome="${provar.home}" projectPath="${testproject.home}" adminUser="<admin user of scratch org>"/>

 

The following errors will be thrown in the ANT log file if the provided details are not correct:

  • An error will be thrown if no users are found in the Scratch org with that admin user
  • An error will be thrown if the passwords are not generated for the required users
  • A warning will be logged if the alias is not found

 

Additional logging

As of Provar 1.8.11, you can enable additional logging for the location of .sfdx folder, authorization, commands which Provar uses in Salesforce DX and the command output.

To get these additional logs, add one additional argument to the ConfigureDx ANT Task you added above:

testOutputlevel=”FINE”

This will get the location of the .sfdx folder, the commands and authorization used and their output in the logs.

The commands output will look like this:

The .sfdx folder and authorization will look like this:

Alternatively, if the log level is not explicitly set to FINE, the output of the Configure-Dx Task will look like this:

Demo video

Watch the video below to see Salesforce DX integration in action: