Generating Maven scripts to run stubs, tests, or suites

HCL OneTest™ API can generate Maven scripts that can be used to run stubs, tests, or suites from a Maven build.

About this task

Follow the steps to generate a Maven script from HCL OneTest API:

Procedure

  1. Select Generate External Tool Configuration from the Tools menu.

    The Generate External Tool Configuration wizard is displayed.

  2. On the Configuration type and environment page, select Maven script for executing stubs, tests, or suites. Select the existing HCL OneTest API environment in which the selected resources are to be run. Click Next.

    The Select resources page is displayed with the project resource tree.

  3. Select the stubs, tests, or suites that are to be included in the script (use Ctrl or Shift to select multiple items). You can select the resources by name or by ID. The advantage of using names is that they are more easily recognizable. If you delete the resource from the project and create another one with the same name, the script will still work. If you choose to use IDs, you can rename or move the resource within the project and the script will still work.

    If one or more resources were selected in the Test Factory perspective, those resources are automatically selected. Click Next.

    The Maven POM options page is displayed.

  4. When you want to run a test by using Maven (optionally with a stub) there are 2 options:
    • Selecting the minimal POM uses the HCL OneTest API Maven plug-in to start selected stubs during the maven pre-integration-test phase, run the integration tests during the maven integration-test phase, and then stop the stubs previously started in the maven post-integration-test phase.
    • Selecting the standard maven Failsafe plug-in uses the standard maven Failsafe plug-in to run integration tests during the maven integration-test phase while using the HCL OneTest API Maven plug-in to run the stubs during the maven pre-integration-test phase and stop them in the maven post-integration-test phase.

    For more information about the lifecycle phases, see the Apache Maven documentation. Click Next.

    The Summary page is displayed with the contents of the script.

  5. View the generated script. Select a location and name for the generated script and click Save to save the file.
    Note: If the file name you select is already in use, HCL OneTest API does not overwrite an existing file. You can use a modified file name, or you can cancel and enter a new name.
  6. Click Finish.

    The generated script is saved to an output file. You can run the script in Maven like any other build script.

Feedback