Documentation

Looking for something in particular?

Automation V3: Salesforce API Testing

Provar Automation provides various Salesforce APIs to assist in rapidly creating and maintaining test data. To add a Salesforce API test step, locate the desired Object in the Explorer and drag it into your test case. 

These Salesforce APIs can also be used to mass-create or update test data, working alongside a source such as an Excel spreadsheet.

SOQL query


A SOQL Query test step is useful for pulling data from specific Salesforce records. Refer to Salesforce’s documentation for more information on SOQL.

To use this API, click and drag an Object from the Explorer into the test case, then select Add a SOQL Query Step

Select which fields to return in the query. Then click the OK button.

This will automatically generate a simple SOQL statement. This statement can be amended manually, e.g., to add a WHERE clause. Refer to the Explorer if unsure of any field’s name.

When this test step is executed, it will populate AccountRows or whatever name is specified in the Result List Name (see screenshot above). This can then be accessed in subsequent test steps. A period can be added after AccountRows to access a specific variable, e.g., AccountRows.Name.

Read/assert


A Read/Assert test step helps validate or check data.

To use this Salesforce API, drag an Object from the Explorer into the test case, then select Add an Object read/assert step

In the following form, tick fields in the second column to read values and tick fields in the first column to create assertions. Then click the OK button.

This will automatically generate the following test step.

Note: An Object Id is required to run this test step.

In this example, reads and asserts have both been added. 

You can modify the assertions, navigate to the Result Assertions tab. 

To add or remove fields after the test step has been added, click the   icon at the top of the Test Step parameters.

Read results will be added to the result object AccountRead or whatever name is specified in the Result Object (see screenshot above). This can then be accessed in subsequent test steps. A period can be added after AccountRead to access a specific variable, e.g., AccountRead.Name.

Asserts have been added as separate sections, validating specific values for Name and Type. If these are not passed during execution, the test step will fail.

Create


A Create test step helps create records.

To use this Salesforce API, drag an Object from the Explorer into the test case, then select Add an Object create step.

Select which fields to populate in the test step. Note that the required fields are ticked automatically. Then click the OK button.

This will automatically generate the following test step.

Note: The selected fields are shown under the Fields section.

To add or remove fields after the test step has been added, click the icon at the top of the Test Step parameters.

When this test step is executed, a new record will be created, and the record ID will be added to the variable named in Result Object Id, e.g., AccountId.

Update


An Update test step helps amend record information at the API level.

To use this Salesforce API, drag an Object from the Explorer into the test case, then select Add an Object update step

Select which fields to populate in the test step. Note that required fields are also identified. Make sure that the Object Id correctly identifies the record to be updated. Where applicable, it will be pre-populated based on the data row chosen from the org browser, but it should generally be updated to a variable storing the record Id, e.g., AccountId. Use Content Assist to locate the correct variable (CTRL + spacebar). In this example, AccountId is populated through the preceding Create test step.

Note: An Object Id is required to run this test step. The fields to be updated are shown under the Fields section.

To add or remove fields after the test step has been added, click the icon at the top of the Test Step parameters.

Delete


A Delete test step deletes a record at the API level.

To use this Salesforce API, drag an Object from the Explorer into the test case, then select Add an Object delete step.

Note: An Object Id is required to run this test step.


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