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:

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

  1. Log in to Test Hub.
    The Projects page of the initial team space is displayed.
  2. Click My projects > project_name to open the project that contains the Salesforce application.
    The Overview page of the project is displayed.
  3. Click Author > Test Editor.
    The Test Editor page and the test navigator panel are displayed.
  4. Perform one of the following actions to create a test:
    1. Click Create asset > Create Test on the Test Editor page.
    2. Right-click the Salesforce application and select New > Test.
    3. 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.
  5. 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:
      1. Select Use an existing edit branch.
      2. 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.
      3. Click Ok.
    • Perform the following steps to create the Edit branch:
      1. Select Create new edit branch.
      2. Enter a name for the Edit branch in the Branch Name field.
      3. Click Save.
  6. Perform the following steps in the Details tab of the Create Test dialog:
    1. 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.

    2. Optional: Select a folder if there are subfolders in Location to save the test assets that you are creating.
    3. Enter a name for the test in Asset Name.
  7. Click Next.
    The Source tab is displayed.
  8. 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.
  9. Start the recording and perform the actions for one Salesforce scenario.
    A Smartshot is captured for each recorded step.
  10. 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.
  11. Stop the recording and save the test.
    The recorded Salesforce test is created and displayed in Test editor.
  12. Perform the following steps to map the dataset, such as UserOTPAuth.csv to map the credential values for multiple users.
    1. Click Configure setting and data in the recorded test.

      The Configure setting and data dialog is displayed.

    2. In the Data section, click the drop-down icon Drop-down icon and select the created dataset from the list. For example, UserOTPAuth.csv.
    3. Click Close to exit the Configure setting and data dialog.
  13. Perform the following steps to reference the mapped OTP value in the test step where Salesforce requires the verification code.:
    1. 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.

    2. In the Value field, enter the variable reference for the mapped OTP secret.
    3. Click the Close icon to close the run details pane.
  14. Click Save to save the modifications.

Results

You have recorded a Salesforce Lightning application test and configured it to use credential and OTP values for different users.