Recording and configuring Salesforce application tests
You can record Salesforce Lightning application interactions to create automated tests and configure the recorded test with credential values for one or more users.
Before you begin
You must have completed the following tasks:
- Configured the Salesforce application as described in Configuration of Salesforce Lightning tests.
- Read and understood the information in Recording a Web UI test.
- Ensured that your project contains an application.
About this task
You can record a Salesforce Lightning application interactions from Test Editor and configure the recorded test to use credential values for single or multiple users. Test Hub captures the actions performed for a Salesforce Lightning test as Smartshots.
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.
- Select a browser from the Browser drop-down list.
- Select UI from the Interactions drop-down list.
- Click Record.
-
Click the UI controls and perform user actions in the application to record test
steps.
You must allow some delay of a few seconds between two user actions to ensure that the UI elements are recognized and registered properly.
-
Close the browser to stop the recording.
The 'The asset is now ready for your review' message is displayed in the Create Asset dialog.
-
Click Done.
The newly recorded Salesforce test is displayed in Test Editor. The test is displayed in the Visual view, which is the default view. You can switch to the Code view to view all the step details.
-
Perform the following steps to configure the recorded test for a single user or
multiple users:
Configuration Action Single user Ensure that the configured environment, such as SFEnv, is selected from the Environment drop-down list. The variables referenced in the test are then mapped to the corresponding secrets configured in the environment. Multiple users Perform the following steps to select the UserOTPAuth dataset to provide the required 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.The variables from the selected dataset are displayed.
- In the Value field, select the corresponding dataset column from the drop-down list. The value of the variable is resolved from the selected dataset column.
- Click Close to exit the Configure setting and data dialog.
- Click Configure setting and data in the recorded
test.
- Click Save to save the modifications.