Run tests in a Docker container
Use an OpenText Functional Testing Docker image to speed up maintenance and test runs.
This topic assumes some knowledge in Docker management and does not describe the Docker management steps in detail.
Available Docker images
Use OpenText Functional Testing Docker images to run tests in a Docker container. The images are available from https://hub.docker.com/r/functionaltesting/.
The OpenText Functional Testing images support the following functionality:
- Run mobile tests using OpenText Functional Testing Lab and OpenText Functional Testing automation scripts.
- Run API tests in a Windows Docker environment.
- Run tests on Headless Chrome using OpenText Functional Testing automation scripts.
- Run API tests in a Linux Docker environment.
The following images are available with the current OpenText Functional Testing version:
-
The uft image is a full Windows Docker image with OpenText Functional Testing installed.
-
The uft_utils image is based on the uft image but also includes additional utility tools.
-
The uft_one_for_api_tests image is a Linux-based image with the OpenText Functional Testing Runtime Engine installed.
Advantages to using the OpenText Functional Testing Utility Docker image
The uft_utils image enables the following enhancements:
Simpler test running | Run your tests more smoothly and easily in a Windows Docker environment using a single command. |
Run multiple API tests | You can now use one Docker command to run of all the API tests stored in a specified folder. |
Convert run results to a JUnit report | After the tests run, use the ReportConverter utility to create a JUnit report from the run results. |
Use Docker images in your CI-CD pipelines | Use the utility tools incorporated in the Docker image to run tests on the Docker image from your CI-CD pipelines. |
The OpenText Functional Testing Utility Docker image is released more frequently than the uft image. For instructions on using this image, use the documentation available with the image on the Docker Hub.
System requirements for the Windows Docker images
You can run tests in a Windows Docker container on one of the following operating systems:
-
Windows Server 2016
-
Windows 10
Versions: 2004, 1903, 1803
Overview: Use OpenText Functional Testing's Docker images
To run tests in a Docker container, you must perform the following steps, which are described in more detail below:
- Pull the Docker image from the Docker hub.
- Create a container based on that Docker image.
- Install a concurrent OpenText Functional Testing license on the container.
- Run your tests in the Docker containers.
You must install an OpenText Functional Testing license on each Docker container that you use. You can handle this in one of the following ways:
-
After installing the license, you can commit this container to a new image. Then, create all subsequent containers based on the new image, and avoid additional license installations.
-
After installing the license, use the same container for subsequent runs, stopping and starting the container as needed.
-
Use a Docker command that creates a new container, installs the concurrent license, and then runs the tests.
Before you create Docker containers
This section describes how to prepare to set up an OpenText Functional Testing Docker container.
Prerequisites
-
Install and set up Docker on your computer so it can pull Docker images from the Docker Hub. This sets up your computer as a Docker host.
Install the Docker Engine and client as described in the Microsoft documentation.
For details on setting up Docker, see the Docker documentation.
-
Enable hardware and software virtualization on your computer.
-
Make sure your Docker is configured to run the right type of container.
Right-click the Docker tray icon. If Switch to Linux containers is displayed in the menu options, your Docker is set up for Windows containers.
Pull the Docker image
To pull the OpenText Functional Testing Docker image, run the following command in a command window on the host computer:
docker pull <OpenText Functional Testing Docker image name>[:tag]
The OpenText Functional Testing Docker image name can be functionaltesting/uft, functionaltesting/uft_utils. or functionaltesting/uft_one_for_api_tests. Choose which image to use based on the image descriptions in Available Docker images.
[:tag] is an optional flag to add for a specific image version. By default the tag value is latest
.
Set up the Windows Docker container
This section explains how to set up the OpenText Functional Testing Windows Docker container:
-
To create the Docker Windows container from the UFT Docker image you pulled, run the following command in a command window on the host computer:
docker run -it --name <container name> <OpenText Functional Testing Docker image name>[:tag] "cmd.exe"
This command creates the container and also opens a command window that belongs to the container. Use this window in the next step to install an OpenText Functional Testing license.
Note: The OpenText Functional Testing Docker images are based on Windows Server 2016. If you use a Docker host with a different OS, you may encounter a message about OS incompatibility. Consult the Docker documentation to mitigate this issue. For example, adding
--isolation=hyperv
or-–isolation=process
to the command may solve the problem.
Install a license in the Windows Docker container
OpenText Functional Testing's Docker image is supported for concurrent licenses only, a license being consumed from the server each time a Docker container uses OpenText Functional Testing.
In a command window for your Docker container, install a concurrent OpenText Functional Testing license on the container. For details, see Manage licenses with the command line.
Run mobile tests in your Windows Docker container
After installing and configuring your Windows Docker container, set up the integration with OpenText Functional Testing Lab, create an OpenText Functional Testing automation script, and then run the script in the Docker container.
Configure the integration
To run tests on mobile devices, make sure that OpenText Functional Testing Lab and your applications are set up for the integration. For details, see Set up OpenText Functional Testing Lab.
The automation script that you create in the next step sets up the connection to OpenText Functional Testing Lab.
Create a mobile automation script
Running tests on your Docker container is done using an OpenText Functional Testing automation script that contains the steps required to run your tests in OpenText Functional Testing Lab.
Your script should include the following parts:
- Launch OpenText Functional Testing.
- Use the DLConnection object to configure the connection to OpenText Functional Testing Lab.
- Use Launch methods to start your application.
- Run your test.
- Close the test.
- Close OpenText Functional Testing.
The following is a sample script used to run a specific test in OpenText Functional Testing Lab.
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable Set qtApp = CreateObject("QuickTest.Application") qtApp.Launch qtApp.Visible = True qtApp.Options.DLConnection.Server = "<lab server address>" qtApp.Options.DLConnection.Port = "<lab server port>" qtApp.Options.DLConnection.Username = "<lab user name>" qtApp.Options.DLConnection.Password = "<lab user password>" qtApp.Options.DLConnection.UseSSL = false qtApp.Options.DLConnection.SharedSpace = "<lab TenantID>" qtApp.Options.DLConnection.WorkSpace = "<lab workspace ID>" qtApp.Options.DLConnection.ShowRemoteWndOnRun = true qtApp.Open "<test script path>", True Set qtMobileLauncher = qtApp.Test.Settings.Launchers("Mobile") qtMobileLauncher.Lab = "DigitalLab" qtMobileLauncher.Device.OS = "<Device OS Type>" qtMobileLauncher.Device.ID = "<Device UDID>" Set launchApp = qtMobileLauncher.LaunchOnStart launchApp.IsPackaged = True launchApp.Counter = 1 qtMobileLauncher.InstallApps = true qtMobileLauncher.RestartApps = true qtMobileLauncher.UninstallApps = false qtMobileLauncher.TrackCPUMetric = true qtMobileLauncher.TrackMemoryMetric = true qtMobileLauncher.TrackFreeMemoryMetric = true qtMobileLauncher.TrackLogs = true Set qtpResultsOpt = CreateObject("QuickTest.RunResultsOptions") 'create the run Results Options object qtpResultsOpt.ResultsLocation = "<HTML report path>" qtApp.Test.Run qtpResultsOpt ' Run the test qtApp.Test.Close qtApp.Quit
Note: If you copy this text for use in your automation script, make sure to replace the placeholders for the lab server connection details with the values from your OpenText Functional Testing Lab server.
For more details, see:
Run the automation script in the Docker container
In a command window on the host computer, run the following command:
docker run -it --name <container-name> -v <host-directory>:<container-directory> <OpenText Functional Testing Docker image name>[:tag] cmd //Add [:tag] to specify an image version. Default is 'latest'.
cd <container-directory>
<script-name>.vbs //Run the automation script
where:
Parameter name | Description |
---|---|
<container-name> |
The name of your Docker container. Use a unique container name to create a new container. |
<host-directory> |
The full path to the host directory on the machine where the automation script is stored. This directory is mounted to the <container-directory> location on your Docker container. |
<container-directory> | The full path to the directory on your Docker container where the <host-directory> is mounted. |
<OpenText Functional Testing Docker image name> |
The OpenText Functional Testing Docker image name, functionaltesting/uft. |
<script-name> | The name of the OpenText Functional Testing automation script configured to run your tests. |
Note: Include the optional [:tag] for a specific Docker image version. By default, the tag value is latest
.
Run an API test in a Windows Docker container
Run your API test in one of the ways described below.
Prerequisites
- Set up an OpenText Functional Testing Docker container as described above.
- On the host computer, create a local directory for your API tests and store the test folders there. Docker will mount this directory to a directory in your Docker container.
Run tests in a new container
Run the tests in a new container based on an image you created with the OpenText Functional Testing license installed.
In a command window on the host computer run the following command:
docker run -v <host-test-directory >:<container-test-directory> --name <container-name> <image-with-license> "<Installdir>\bin\HP.ST.Fwk.InternalExecuter.exe" -test <container-test-directory> -reportPath <report-directory-path>
where:
Parameter name | Description |
---|---|
<container-name> |
The name of the Docker container to create for this run. Use a unique container name to create a new container. |
<host-test-directory> |
The full path to the API test on the host computer. This directory is mounted to the <container-test-directory> location on your Docker container. Example: C:\DockerProject\tests\apitest, where C:\DockerProject\tests is the local directory you created for your tests and apitest is the name of the test you stored there. Note: The test-name part of this path is case sensitive. |
<image-with-license> | The image that you committed after installing the OpenText Functional Testing license. This image is used to generate the new container that runs your test. |
<container-test-directory> | The full path to the directory on your Docker container where the <host-test-directory> is mounted. |
<report-directory-path> |
(Optional) The path to the directory in which to store the test results. Provide a relative path, relative to the <container-test-directory>. By default, the results are saved under the test folder, overwriting the results of any previous runs. |
For example if your host test directory was C:\DockerProject\tests and the test name is apitest, the command would look like this:
docker run -v C:\DockerProject\tests\apitest:C:\tests\apitest --name apirun functionaltesting/uft:latest "C:\Program Files (x86)\OpenText\UFT One\bin\HP.ST.Fwk.InternalExecuter.exe" -test C:\tests\apitest
Run the test on an existing container
In a command window on the host computer run the following command:
docker exec -it <container-name> "<Installdir>\bin\HP.ST.Fwk.InternalExecuter.exe" -test <container-test-directory> -reportPath <report-directory-path>
where:
Parameter name | Description |
---|---|
<container-name> |
The name of the existing Docker container to use for this run. Tip: Make sure the container is running before you run this command. |
<container-test-directory> | The full path to the directory on your Docker container where the <host-test-directory> is mounted. |
<report-directory-path> |
(Optional) The path to the directory in which to store the test results. Provide a relative path, relative to the <container-test-directory>. By default, the results are saved under the test folder, overwriting the results of any previous runs. |
For example if your container name is apirun, the host test directory was C:\DockerProject\tests and the test name is apitest, the command would look like this:
docker exec -it apirun "C:\Program Files (x86)\OpenText\UFT One\bin\HP.ST.Fwk.InternalExecuter.exe" -test C:\tests\apitest -reportPath result1
Use Jenkins to trigger an API test run in Windows Docker container
After setting up your Windows Docker container, you can use Jenkins to trigger the API test run:
-
On the host computer, create a local directory for your API test and store the test there.
-
Add the Docker container as an agent in Jenkins.
-
Add a build step and select "Execute Windows batch command".
-
In the step, insert the command to trigger the test. Do one of the following:
-
Create a new container based on an OpenText Functional Testing Windows Docker image that was committed after installing a license and then run the API tests.
docker run -v <host-test-directory >:<container-test-directory> --name <container-name> <image-with-license> "<Installdir>\bin\HP.ST.Fwk.InternalExecuter.exe" -test <container-test-directory> -reportPath <report-directory-path>
-
Create a new container based on the downloaded OpenText Functional Testing image, install a concurrent license on the container, and then run the API tests:
docker run -dit --name <container-name> -v <host-test-directory >:<container-test-directory> <OpenText Functional Testing Docker image name>[:tag] cmd.exe /C " " <Installdir>/bin/HP.UFT.LicenseInstall.exe" concurrent <license ID> <license version> <primary server name/address>:<port> & "<Installdir>/bin\HP.ST.Fwk.InternalExecuter.exe" -test <container-test-directory> -reportPath <report-directory-path>
For details on this command, see Run an API test in a Windows Docker container.
-
Run web and AI-based web tests in a Windows Docker container
Web and AI-based web tests in Docker can run only on Headless Chrome. This section describes how to create an OpenText Functional Testing automation script to run such tests on Headless Chrome in Docker.
To run web and AI-based web tests on Headless Chrome in a Docker container:
-
Prerequisites: Set up your Windows Docker container and make sure you have performed all steps described in Prepare to run tests on Headless Chrome.
-
Create an OpenText Functional Testing automation script that includes the following parts:
-
Launch OpenText Functional Testing.
-
Use the WebLauncher object to set the browser type.
To run AI-based web tests, AI Object Detection must be enabled. AI Object Detection is enabled by default, but if necessary, add steps to enable them.
-
Run your test.
-
Close the test.
-
Close OpenText Functional Testing.
The following is a sample script:
Copy codeDim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Dim qtAutoExportResultsOpts 'As QuickTest.AutoExportReportConfigOptions ' Declare the Automatically Export Report Configuration Options object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start OpenText Functional Testing
qtApp.Visible = False ' Make the OpenText Functional Testing application invisible
qtApp.Open "c:\tests\Headless" '
'Set run settings for the test
Set qtTest = qtApp.Test
'Set RnR setting
qtApp.Test.Settings.Launchers("Web").Active = True
qtApp.Test.Settings.Launchers("Web").Browser = "CHROME_HEADLESS"
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = "c:\tests\reports"
qtTest.Run qtResultsOpt ' Run the test
qtApp.Test.Close
qtApp.Quit -
-
In a command window on the host computer, run the following command:
Copy codedocker run -it --name <container-name> -v <host-directory>:<container-directory> <OpenText Functional Testing Docker image name>[:tag] cmd //Add [:tag] to specify an image version. Default is 'latest'.
cd <container-directory>
<script-name>.vbs //Run the automation scriptNote:
-
Replace the parameters in the command with actual values. For information about these parameters, see Run mobile tests in your Windows Docker container.
-
If you run a test that contains steps using AI object identification, note the limitations described in Testing on headless browsers.
-
Run API tests in a Linux Docker container
Running API tests in a Linux Docker container is supported as a technical preview.
Prepare the prerequisites and pull the uft_one_for_api_tests image, as described in Before you create Docker containers.
Running an API test requires a concurrent license.
Run the following command to install an OpenText Functional Testing license and run API tests:
docker run -it -v <host-test-directory>:<container-test-directory> functionaltesting/uft_one_for_api_tests[:tag] -test <container-test-directory> -reportPath <report-directory-path> -licenseServer <License_server_ip>:<port>
Where:
Parameter name | Description |
---|---|
<host-test-directory> |
The full path to the API test on the host computer. This directory is mounted to the container test directory. |
<container-test-directory> |
The full path to the directory on your Docker container where the <host-test-directory> is mounted. Example: C:\DockerProject\tests\apitest, where C:\DockerProject\tests is the local directory you created for your tests, and apitest is the name of the test you stored there. |
<report-directory-path> |
(Optional) The path to the directory in which to store the test results. Provide a relative path, relative to the <container-test-directory> By default, the results are saved under the test folder, overwriting the results of any previous runs. |
<License_server_ip>:<port> | The IP address and port number for your concurrent license server. |
Technical preview scope
The table below describes the activities you can run in API tests on the Linux-based image:
Supported activities | Unsupported activities |
---|---|
Date/Time |
CoAP |
Flow |
DataBase |
FTP | Calling external GUI and API tests |
HTTP |
File |
JSON |
IBM WebSphere MQ |
Math |
JMS |
REST |
Java |
SOAP |
MQTT |
String |
SAP |
System variables |
WebSocket |
XML |
|
Miscellaneous operations |
See also: