As part of your testing with Docker, you can publish stubs that you create in Test Integrations and APIs to Docker and build context by using
the Publish Stubs wizard.
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. For more information, refer to the related
links.
From the Test Integrations and APIs Publish
Stubs wizard, publish one or more stubs to a Dockerfile and build context.
-
In Test Integrations and APIs 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.
-
On the Publish destination page, select Dockerfile and build
context. Click Next. The Environment page is
displayed.
-
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 Test Integrations and APIs is selected.
-
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.
-
Optionally, modify the settings for transports with conflicting port values to avoid the
conflicts. Changes that you make are applied to the project.
-
From the Dockerfile template and comment page, in the Template
list, select the template to be used to generate the Dockerfile. Test Integrations and APIs provides a ubuntu template for you
to use that will generate Dockerfiles that will build images based on the Ubuntu operating
system.
-
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.
-
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, refer to Supported
transports to publish stubs to a Dockerfile and build context in Related
concepts.
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
-
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 in Related information.
When the Docker image is created, it can be run as a container. For information about running
the container, refer to Publishing stubs to Docker in Related
concepts.