Running an API Suite that references local stubs by using proxies

When you want to run an API Suite that references local stubs, you can use the HTTP proxy registered with HCL OneTest Server to run the local stubs. The API Suite also contains tests that run on the stubs. You must configure the HTTP transport to use the HTTP proxy in the project and commit the project to the remote repository.

Before you begin

You must have completed the following tasks:
  • Been assigned the Tester or Owner role to run the tests.
  • Read Test run considerations for API Suites.
  • Created a test suite that contains stubs that are configured to run on the HTTP proxy registered with HCL OneTest Server and tests that run on the stub.
  • Committed the test resources to the remote repository.
  • Set up the HTTP proxy and registered the proxy with HCL OneTest Server. See Setting up the HTTP proxy.

Procedure

  1. Open the project that contains the test assets or resources that you added from the Git repository, and then click Execution.
  2. Select the branch of the repository that contains the test assets or resources that you want to run.

    All test assets in the selected branch are displayed on the Execution page.

  3. Identify the test asset or resource that you want to run by performing any of the following steps:
    1. Look for the test asset or resource by scrolling through the list.
      Note: You can also identify the type of the asset or resource by looking for the icon that represents the test type, as shown in the following table:
      Icon Represents the test asset or resource
      AFT Suite
      API Suite
      Compound Test
      JMeter Test
      Postman resources
      Rate Schedule
      Stubs
      VU Schedule
    2. Search for the test asset or resource by entering any text contained in the test asset or resource name in the Search text box.
    3. Create a filter query by using the New filter option by performing the following steps:
      1. Click New filter.
      2. Add or enter the relevant parameters for the filter query.
      3. Apply the filter query to filter the assets based on the query.
      4. Save the filter query, if you want to reuse the filter query later, by performing the following steps:
        1. Click Save.
        2. Enter a name for the filter query.
        3. Click Save.
    4. Retrieve a saved filter, if you have saved filter queries earlier by performing the following steps:
      1. Click the Open filters icon Image of the icon..
        Note: To open the filter query, you must have created and saved a filter query.
      2. Select the saved filter in the Filters dialog box.
      3. Click Apply to apply the filter.
  4. Click the Execute icon Image of the icon. in the row of the identified test asset.

    The Execute test asset dialog box is displayed.

  5. Select the version of the test resources that you want to run by completing any of the following actions:
    Note: The test resources in the version can contain the test assets, datasets, AFT XML files, API environment tags, and other resources specific to projects created from any of the desktop clients.
    1. Expand the list in the Version field, find the version of the test resources, and then select the version.
      Use the following details about the version of the test resources that are displayed to identify the version that you want:
      • Commit message.
      • Tags labeled by the user for the version committed.
      • The user who committed the version to the repository.
      • Relative time of the commit. For example, 2 hours ago or 3 days ago.

      The list displays the versions of the test resources committed by all users to the branch in the repository. The versions are arranged with the latest version committed followed by the versions committed previously.

    2. Expand the list in the Version field, and search for the version that you want to select by entering a partial or the complete commit message of that version.

      The version that matches the search criteria is displayed and is selected for the test run.

    The default value for the version selected for the run is the latest version in the selected branch in the repository. If you do not select any version, then the latest version is selected for the test run.
    Notes:
    • If you selected a version but you do not want to use that version in the test run, you can remove the selected version by clicking the Image of the icon. icon, then the default version is selected for the test run.
    • If you repeated a test or ran the test again from the Results page, then the version of the test resources that you had selected for the earlier run is shown as selected. You can either retain this version or select any other version from the list. You can also remove the previous version by clicking the Image of the icon. icon.
  6. Select the time for scheduling the test run from the following options:
    • Select Now to initiate the test run immediately after you click Execute.
      Important: Click Execute only after you have configured the other settings in this dialog box.
    • Select Later and configure the date and time for scheduling a test to run at the scheduled date and time.

    The default time for scheduling a run is Now.

    Notes:
    • If you have configured some or all of the settings for the current test run, and you do not want to continue with those settings, you can reset the settings by clicking Reset.

    • If you are repeating a test run and do not want to use the saved settings from a previous run, you can reset all the saved settings to their default values by clicking Reset.

  7. Enter a label for the test run that helps you to identify the test on the Results page.

    After the test run completes, the label that you entered is displayed for the test under the Labels column on the Results page. After you have created a label, any member of the project can use that label.

    The default value for the Label field is null or an empty field.

    Important: The configuration that you set for the test run in the Execute test asset dialog box is preserved when you run the same test again. Those changes are not visible when another user logs in to HCL OneTest Server. For example, if you created new variables on the server, those variables are available only for you when the same test is run again.

    If you want to run the test immediately or at the scheduled time, click Execute, or continue with the next step.

  8. Follow the instructions if the API Suite has an environment or secrets configured:
    1. Click the ENVIRONMENT tab, if it is not already open.
    2. Select the API test environment from the list if there are multiple environments configured in the test asset.
    3. Select the secrets collection that contains the secrets to be used for the test run.
    Notes:
    • The test asset that was created in the desktop client and added to the Git repository must have the environments defined as part of the API test project.
    • If the test asset contained secrets, then you must create those secrets in secrets collections in the project.

    The default value for the environment is the environment configured in the test asset. The default value for secrets is null or an empty field.

    If you want to run the test immediately or at the scheduled time, click Execute, or continue with the next step.

  9. Click Execute.
    The test run is started.

Results

You have either started or scheduled a test run for an API Suite that contains stubs and tests that run on the stubs. The stubs run on the HTTP proxy configured in the API Suite and the tests in the API Suite run on the stubs. The stub is automatically started, tests are run on the stub, and then the stub is stopped.

What to do next

You can choose to perform any of the following tasks after you have initiated or scheduled a run: