API testing

Provar provides various APIs to assist in the rapid creation and maintenance of test data. To add an API test step, click on a row in the org browser and drag it into your test case. These APIs can also be used to mass-create or update test data, working alongside a source such as an Excel spreadsheet.

Usage


To add an API test step, click on a row in the org browser and drag it into your test case. Test steps will be added with the same connection as the one selected in the org browser, but this can be overridden if wanted.

Note: Provar generally logs the Salesforce test data created during a test run. This can be controlled per test case, and is controlled by the Enable Object Id Logging checkbox on the Salesforce Connect test step.

Provar can automatically delete data at the end of a test run if wanted. To enable this option, tick the checkbox Auto Cleanup. If the test case’s connection user does not have privileges to perform the cleanup, specify an admin connection in Cleanup Connection Name. This information will be written to the log file when the cleanup is performed.

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 a row from the org browser into the test case, then select Add a SOQL Query Step. Make sure that the row chosen in the org browser corresponds to the object you want to query (e.g. Opportunity).

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 Org Browser if you are unsure of the name for any given field.

When this test step is executed, it will populate OpportunityRows, 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 OpportunityRows to access a specific variable, e.g. OpportunityRows.Name.

Read/assert


A Read/Assert test step is useful for validating or checking data.

To use this API, click and drag a row of data from the org browser into the test case, then select Add an Object read/assert step. Make sure that the row chosen in the org browser corresponds to the object you want to read/assert (e.g. Opportunity).

In the form which follows, tick fields in the first column to read values and tick fields in the second column to create asserts. 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. 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 OpportunityRead, 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 OpportunityRead to access a specific variable, e.g. OpportunityRead.StageName.

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

Create


A Create test step is useful for creating records.

To use this API, click and drag a row from the org browser into the test case, then select Add an Object create step. Make sure that the row chosen in the org browser corresponds to the object you want to create (e.g. Opportunity).

Select which fields to populate in the test step. Note that 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 added to the variable named in Result Object Id, e.g. OpportunityId.

Update


An Update test step is useful for amending record information at the API level.

To use this API, click and drag a row from the org browser into the test case, then select Add an Object update step. Make sure that the row chosen in the org browser corresponds to the object you want to update (e.g. Opportunity).

Select which fields to populate in the test step. Note that required fields are also identified. Make sure that Object Id correctly identifies the record to be updated. Where applicable, it will be prepopulated 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. OpportunityId. Use Content Assist to locate the correct variable (CTRL + spacebar). In this example, OpportunityId 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


Delete test step is used to delete a record at the API level.

To use this API, click and drag a row of data from the org browser into the test case, then select Add an Object delete step. Make sure that the row chosen in the org browser corresponds to the object you want to delete (e.g. Opportunity).

Review Provar on G2
Documentation library

Other available resources

Looking for something different?

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