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:

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

  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.
  9. Select a browser from the Browser drop-down list.
  10. Select UI from the Interactions drop-down list.
  11. Click Record.
  12. 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.
  13. Close the browser to stop the recording.
    The 'The asset is now ready for your review' message is displayed in the Create Asset dialog.
  14. 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.
  15. 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:
    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.

      The variables from the selected dataset are displayed.

    3. 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.
    4. Click Close to exit the Configure setting and data dialog.
  16. 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 single or multiple users.