Recording and configuring Salesforce application tests
You can record Salesforce Lightning application interactions from the Test Editor and configure the recorded test with credential and OTP values for different users.
Before you begin
You must have completed the following tasks:
- Configured the Salesforce application as described in Configuration of Salesforce test automation.
- Read and understood Recording a Web UI test.
- Ensured that the Salesforce application is available in the project.
- Ensured that the environment file is configured with the Verification_Code secret. See Creating and mapping the OTP secret in Test Hub.
About this task
You can record a Salesforce Lightning application interactions from the Test Editor and configure the recorded test to use credential and OTP values for different users. Test Hub captures the actions performed for a Salesforce scenario as Smartshots. You can map a dataset to provide credential values for multiple users.
You can reference the Verification_Code variable in the test step that
requires an OTP.
Procedure
-
Log in to Test Hub.
The Projects page of the initial team space is displayed.
-
Click to open the project that contains the Salesforce application.
The Overview page of the project is displayed.
-
Click .
The Test Editor page and the test navigator panel are displayed.
-
Perform one of the following actions to create a test:
- Click on the Test Editor page.
- Right-click the Salesforce application and select .
- Open the Action menu in the test navigator panel and select Test.
The Edit branch dialog is displayed.If the Edit branch dialog is not displayed, then go to step 6. -
Select your action to either select an existing Edit branch or create
an Edit branch:
- Perform the following steps to select an existing Edit
branch:
- Select Use an existing edit branch.
- Select an Edit branch from the Select
branch list if Edit branches already
exist for your repository.Note:A warning message is displayed if the Edit branch, you selected is behind the source branch. To update the selected edit branch and maintain synchronization with the source branch, you can select the Update branch option when switching checkbox.
- Click Ok.
- Perform the following steps to create the Edit branch:
- Select Create new edit branch.
- Enter a name for the Edit branch in the Branch Name field.
- Click Save.
- Perform the following steps to select an existing Edit
branch:
-
Perform the following steps in the Details tab of the
Create Test dialog:
- Select an application for which you want to create a test from the
Application drop-down list.
The application folder is selected as the default location for the test.
- Optional: Select a folder if there are subfolders in Location to save the test assets that you are creating.
- Enter a name for the test in Asset Name.
- Select an application for which you want to create a test from the
Application drop-down list.
-
Click Next.
The Source tab is displayed.
-
Select the By recording option to record a test in the
Select source drop-down list.
Test Hub checks whether the recording agent is installed on your computer. For more information, refer to step 10 in the Recording Web UI test.
-
Start the recording and perform the actions for one Salesforce scenario.
A Smartshot is captured for each recorded step.
-
When Salesforce Lightning controls overlap, open Element View
and select the specific control required by the scenario.
Salesforce Lightning controls can be located within approximately five pixels of one another. Select the controls that correspond to the business requirement instead of trying different controls in the Smartshot.
-
Stop the recording and save the test.
The recorded Salesforce test is created and displayed in Test editor.
-
Perform the following steps to map the dataset, such as
UserOTPAuth.csv to map the credential values for multiple
users.
- Click Configure setting and data in the recorded test.
The Configure setting and data dialog is displayed.
- In the Data section, click the drop-down icon
and select the created dataset from the list. For example,
UserOTPAuth.csv. - Click Close to exit the Configure setting and data dialog.
- Click Configure setting and data in the recorded test.
-
Perform the following steps to reference the mapped OTP value in the test step where
Salesforce requires the verification code.:
- In the recorded test, open the step With 'Verify Your Identity | Salesforce'
that types a value into the Verification Code field.
The step details pane is displayed.
- In the Value field, enter the variable reference for the mapped OTP secret.
- Click the Close icon
to close the run details pane.
- In the recorded test, open the step With 'Verify Your Identity | Salesforce'
that types a value into the Verification Code field.
- Click Save to save the modifications.