Publishing stubs

You can publish a stub to HCL Quality Server or Dockerfile and build context by using the HCL OneTest™ API Publish Stubs wizard.
Note: To publish to a Dockerfile and build context, only stubs that are based on specific transports are supported. For more information, see Supported transports to publish stubs to a Dockerfile and build context.

HCL Quality Server

About this task

From the HCL OneTest API Publish Stubs wizard, publish one or more stubs to an HCL Quality Server instance.

Procedure

  1. In HCL OneTest API Test Factory perspective, right-click the Stubs folder that contains the stub that you want to publish and click Publish Stubs on the menu.

    Alternatively, right-click the operation or component that contains the stub that you want to publish and click Publish Stubs on the menu.

    Note:
    • If the operation or component or logical root that is selected does not contain any stubs, an error message is displayed.
    • When publishing stubs to HCL Quality Server, it is more efficient to publish a container to avoid sending multiple instances of projects to HCL Quality Server when you run the stubs.

    The Publish Stubs wizard is displayed.

  2. On the Publish Destination page, select HCL Quality Server. Click Next.The Publish to RTCP page is displayed.
  3. In the Version fields, enter a version number (an integer) for the stub or set of stubs if more than one was selected for publication. A stub’s version number assists HCL Quality Server users when they are selecting the stubs that they want to run.
    Note: If you republish a stub with the same version, the old stub in the server is deleted. If multiple stubs are published with a specific version, a republish by using the same version must contain all of those stubs.
  4. On the Environments pane, select one or more check boxes of the environment or environments where you want to publish one or more selected stubs.

    An environment enables HCL OneTest API and HCL OneTest Virtualization users to define groups of variables or tags that can be used in both tests and transport definitions.

    Note: By default, the current environment for the project is selected.

    The following table describes the icons that can be displayed on the Environments pane.

    Icon Description
    The specified environment is created on the specified HCL Quality Server instance.
    The specified environment exists on the specified HCL Quality Server instance.
    "N" N" number of new stubs are published ("created") to the specified HCL Quality Server instance.
    "N" N" number of existing stubs are published ("updated") at a new version level to the specified HCL Quality Server instance.
    "N" N" number of existing stubs are published ("replaced") at the same version level on the specified HCL Quality Server instance.
  5. Click Finish.

    One or more selected stubs are published to the specified HCL Quality Server instance.

    A status message is displayed to confirm this.

  6. Click OK.

Dockerfile and build context

Before you begin

Before you build the Docker image for a stub that has been published to a Dockerfile and build context, you must set up to use Docker. See Preparing to use Docker.

About this task

From the HCL OneTest API Publish Stubs wizard, publish one or more stubs to a Dockerfile and build context.

Procedure

  1. In HCL OneTest API Test Factory perspective, right-click the Stubs folder that contains the stub that you want to publish and click Publish Stubs on the menu.

    Alternatively, right-click the operation or component that contains the stub that you want to publish and click Publish Stubs on the menu.

    Note: If the operation or component or logical root that is selected does not contain any stubs, an error message is displayed.

    The Publish Stubs wizard is displayed.

  2. On the Publish destination page, select Dockerfile and build context. Click Next. The Environment page is displayed.
  3. In the Environment list, select the environment where you want to run one or more selected stubs. An environment is used to select the physical bindings and tag values when you run the stubs within the Docker container. This selection might affect network addresses that are used to connect to and from a stub.
    Note: By default, the current environment in HCL OneTest API is selected.
  4. Click Next. If two or more ports that are required by the chosen stubs conflict when they run in a Docker container, the Exposing ports page is displayed. Otherwise, the Dockerfile template and comment page is displayed.
  5. Optionally, modify the settings for transports with conflicting port values to avoid the conflicts. Changes that you make are applied to the project.
  6. From the Dockerfile template and comment page, in the Template list, select the template to be used to generate the Dockerfile. HCL OneTest API provides a ubuntu template for you to use that will generate Dockerfiles that will build images based on the Ubuntu operating system.
  7. Enter the path to an empty directory outside of the project to which the Dockerfile and other required files are output. If the directory does not exist, it is created. Alternatively you can click Browse to browse to and select an empty directory outside of the project.
  8. Click Finish.

    One or more selected stubs are published to the Dockerfile and build context output directory.

    A status message is displayed to confirm this.

    Note: After you publish a TIBCO Rendezvous stub, you must copy the TIBCO Rendezvous libraries that are required by TIBCO Rendezvous to the UserLibs folder of the output directory. If you are publishing a TIBCO EMS stub, you can ignore the message about copying TIBCO Rendezvous libraries. For more information, see Supported transports to publish stubs to a Dockerfile and build context.

    The Dockerfile and build context files in the output directory can be used to build a Docker image.

Build the Docker image by using the Dockerfile

  1. Build the Docker image by using the Dockerfile with following command:
    docker build -t <name> <dockerfile_location>

    Where name is the name and optionally a tag in the 'name:tag' format for the image that you want to create.

    Where dockerfile_location is the output directory that contains the Dockerfile and build context files.

    The following example on Windows systems, builds a Docker image that is named stubimage from a Dockerfile and build context files that were published to C:\myImages\StubA

    docker build -t stubimage C:\myImages\stubA
    Note: If the output directory is not accessible by the Docker client, for example it is on a different computer, the directory must be copied to an accessible directory on the Docker client computer before you run the Docker build command with the dockerfile_location updated.

    For more information about building Docker images, see the Docker Documentation.

What to do next

When the Docker image is created, it can be run as a container. For information about running the container, see Publishing stubs to Docker: Running in a Docker container.

Feedback