Share this page

# Run tests in Docker containers

This topic explains how to use UFT Developer Docker images to run your tests in Docker containers.

Note: This topic assumes you are familiar with Docker. If you are new to Docker and would like to learn more, we recommend that you visit the Docker website.

In this topic:

## UFT Developer and Docker

Docker is a software container platform. It is designed to make it easier to create, deploy, and run applications by using containers. Containers include everything required to make software run. They do not bundle a full operating system (like VMs do), only libraries and settings, which make them efficient, lightweight, self-contained systems.

UFT Developer provides Docker images enabling you to run your tests in Docker containers.

Docker is supported for all Web and mobile technologies.

Using Docker containers has major benefits for developers, DevOps, and the enterprise:

- Zero installation. Run UFT Developer tests without having UFT Developer installed on your machine.
- Background execution. Run your tests in the background and continue to work without distraction.

- Execution box. Use a single command to run the Docker image, run the test, and close the container when the test is done.

- CI/CD readiness. Streamline software delivery by supporting continuous integration and continuous delivery. For details, see Run tests using a CI system.

Back to top

## UFT Developer Docker images

There are three UFT Developer docker images:

- functionaltesting/leanft. The basic UFT Developer image, which contains the engine and the capabilities to run UFT Developer tests.
- functionaltesting/leanft-chrome. The basic UFT Developer image with a Chrome browser.
- functionaltesting/leanft-firefox. The basic UFT Developer image with a Firefox browser.

You can use the basic functionaltesting/leanft image that we supply and create a customized image that runs a different browser version. For instructions refer to the Docker Hub website.

Tip: To find out which versions of Chrome or Firefox browsers are included with the image, add the following to the end of the docker command (described in Run the Docker image):

Chrome: `google-chrome --version`

Firefox: `firefox --version`

Java

The UFT Developer 15.x docker images come with Java 8 installed.

Back to top

## Standalone mode vs. execution box mode

You can run UFT Developer tests in two modes: standalone or as an execution box.

Standalone

This mode is like running tests remotely.

In this mode, you start the UFT Developer container which launches the UFT Developer engine. The engine then waits for commands. You run the test separately, on your machine. You may need to update the UFT Developer engine address (IP or host name) in the test in order to connect to the Docker image. When you run the test, the commands are executed within the Docker container. You need to stop the container when you are done.

For details on running tests remotely, see Run tests remotely.

Execution box

This mode is like running the UFT Developer engine and the test on the same machine.

In this mode, you run the UFT Developer container, which launches the test within the container and closes the container when the test completes.

Back to top

## License usage

UFT Developer Docker integration is supported only for concurrent UFT Developer licenses. For more details on license types, see UFT Developer licensing.

When you run the UFT Developer image, you need to indicate which license server to use. You can do that in one of two ways:

- Using `--add-host=license-server:<enter your license address>`
- Using the LFT_LIC_SERVER environment variable. For more details, see License.

Back to top

## Download the UFT Developer image to your registry

Before you begin you must first have Docker installed on your machine.

Download one of the following images to your machine using the pull command from a command line:

- functionaltesting/leanft
- functionaltesting/leanft-chrome
- functionaltesting/leanft-firefox

For example:

docker pull functionaltesting/leanft

Back to top

## Run the Docker image

1. Decide in which mode you want to run the Docker image standalone mode or execution box. For details, see Standalone mode vs. execution box mode.

2. To run the Docker image in standalone mode:

   Run the following from a command line:

   docker run -it -p 5095:5095 -p 5900:5900 --add-host=license-server:xx.xx.xx.xx <UFT Developer container>

   What does this command do?

   `docker run` | The Docker CLI command for running the container.
   `-it` | Instructs the Docker to run in the foreground so that you can track the output of the container. You can use Ctrl+C to stop the container.
   `-p 5095:5095` | Maps the host's 5095 port (the UFT Developer default port) to the container's 5095 port, to connect to the UFT Developer engine.
   `-p 5900:5900` | Optional. Maps port 5900 to the container's 5900 port, to connect to a VNC. Use this option if you would like to see the Docker container. For example, for debugging purposes. When you connect to the VNC client, use the password: PASSWORD
   `--add-host=license-server:xx.xx.xx.xx` | Instructs the container which IP address to use for the UFT Developer license server. Replace xx.xx.xx.xx with your license server IP address.
   `<UFT Developer container>` | Instructs Docker to create a container. Possible values: functionaltesting/leanft, functionaltesting/leanft-chrome, functionaltesting/leanft-firefox. Optionally, append `:<version number>` to the container name. By default the latest version is used.

   Note:

   - The report is generated from the location as the test is run.
   - You can also use docker's -u <name|uid>[:<group|gid>] option to specify the user to use in the container.

   Use environment variables as required. For details, see Run the UFT Developer image with environment variables.

1. To run the Docker image as an execution box:

   This mode is supported for both Java and JavaScript.

   Java

   Run the following from a command line:

   docker run -it -p 5900:5900 --add-host=license-server:xx.xx.xx.xx -e RUN_MODE=junit -e RUN_CMD="com.company.UFTDeveloperTest" -v <full path on the host’s machine to java jars>:/tests -w /tests <UFT Developer container>

   What does this command do?

   `docker run` | The Docker CLI command for running the container.
   `-it` | Instructs the Docker to run in the foreground so that you can track the output of the container. You can use Ctrl+C to stop the container.
   `-p 5900:5900` | Optional. Maps port 5900 to the container's 5900 port, to connect to a VNC. Use this option if you would like to see the Docker container. For example, for debugging purposes. When you connect to the VNC client, use the password: PASSWORD
   `--add-host=license-server:xx.xx.xx.xx` | Instructs the container which IP address to use for the UFT Developer license server. Replace xx.xx.xx.xx with your license server IP address.
   `-e RUN_MODE=junit` | Indicates that this is a JUnit test. JUnit is the only framework supported for Java.
   `-e RUN_CMD="com.company.UFTDeveloperTest"` | Instructs the container to run the test using the com.company.UFTDeveloperTest class.
   `-v <full path on the host’s machine to java jars>:/tests` | Maps the host’s test directory to the container's /tests directory. After the test report is generated you will be able to access it from the your machine in the path you defined.
   `-w /tests` | Indicates that the working directory on the container will be /tests. The tests are run from this location and this is where the tests reports will be generated.
   `<UFT Developer container>` | Instructs Docker to create a container. Possible values: functionaltesting/leanft, functionaltesting/leanft-chrome, functionaltesting/leanft-firefox. Optionally, append `:<version number>` to the container name. By default the latest version is used.

   JavaScript

   docker run -it -p 5900:5900 --add-host=license-server:xx.xx.xx.xx -v <full path on the host’s machine to javascript mocha project>:/tests -w /tests <UFT Developer container>

   What does this command do?

   `docker run` | The Docker CLI command for running the container. Note: This command runs npm test, which runs the test script in the package.json file. Make sure that the test script is defined correctly in the file. For example:
       "scripts": {
       "test": "jasmine plutoE2e.js"
       }
   `-it` | Instructs the Docker to run in the foreground so that you can track the output of the container. You can use Ctrl+C to stop the container.
   `-p 5900:5900` | Optional. Maps port 5900 to the container's 5900 port, to connect to a VNC. Use this option if you would like to see the Docker container. For example, for debugging purposes. When you connect to the VNC client, use the password: PASSWORD
   `--add-host=license-server:xx.xx.xx.xx` | Instructs the container which IP address to use for the UFT Developer license server. Replace xx.xx.xx.xx with your license server IP address.
   `-v <full path on the host’s machine to javascript project>:/tests` | Maps the host’s test directory to the container's /tests directory. After the test report is generated you will be able to access it from the your machine.
   `-w /tests` | Indicates that the working directory on the container will be /tests. This is where the tests reports will be generated.
   `<UFT Developer container>` | Instructs Docker to create a container. Possible values: functionaltesting/leanft, functionaltesting/leanft-chrome, functionaltesting/leanft-firefox. Optionally, append `:<version number>` to the container name. By default the latest version is used.

   Use environment variables as required. For details, see Run the UFT Developer image with environment variables.

2. After your container is up and running, run your UFT Developer tests from your local machine as you always do. The browser will be launched inside the container and your script commands will be executed there.

Back to top

## Run the docker image in a UFT Developer grid configuration

Supported in UFT Developer versions 15.0.2 and later.

You can set up a UFT Developer grid configuration using multiple UFT Developer docker containers. Run one container as a grid and others as grid nodes. For details on using a UFT Developer grid, see UFT Developer Grid.

Use environment variables as required. For details, see Run the UFT Developer image with environment variables.

To run UFT Developer tests in a grid configuration using docker images

1. Run a UFT Developer docker image as a grid

   docker run -it -p 5095:5095 -p 8080:8080 --add-host=license-server:xx.xx.xx.xxx -e LFT_RUN_MODE="grid" -e LFT_GRID_PASSPHRASE="<encrypted passphrase>" <UFT Developer container>

   What does this command do?

   `docker run` | The Docker CLI command for running the container.
   `-it` | Instructs the Docker to run in the foreground so that you can track the output of the container. You can use Ctrl+C to stop the container.
   `-p 5095:5095` | Maps the host's 5095 port (the UFT Developer default engine port) to the grid container's 5095 port, to connect to the UFT Developer engine.
   `-p 8080:8080` | Maps the host's 8080 port (the UFT Developer default management port) to the grid container's 8080 port, to use for the grid management user interface.
   `--add-host=license-server:xx.xx.xx.xx` | Instructs the container which IP address to use for the UFT Developer license server. Replace xx.xx.xx.xx with your license server IP address.
   `"-e LFT_RUN_MODE="grid"` | Instructs the container to run UFT Developer as a grid.
   `-e LFT_GRID_PASSPHRASE="<encrypted passphrase>"` | Specifies the passphrase that nodes need to use to connect to the grid.
   `<UFT Developer container>` | Instructs Docker to create a container. Possible values: functionaltesting/leanft, functionaltesting/leanft-chrome, functionaltesting/leanft-firefox. Optionally, append `:<version number>` to the container name. By default the latest version is used.

2. Run UFT Developer docker images as grid nodes

   docker run -it -p 5900:5900 -e LFT_RUN_MODE="node" -e LFT_GRID_PASSPHRASE="<encrypted passphrase>" -e LFT_GRID_NODE_NAME="<Node Name>" -e LFT_GRID_ADDRESS="ws://<IP address>:5095" <UFT Developer container>

   What does this command do?

   `docker run` | The Docker CLI command for running the container.
   `-it` | Instructs the Docker to run in the foreground so that you can track the output of the container. You can use Ctrl+C to stop the container.
   `-p 5900:5900` | Optional. Maps the host's port 5900 to the node container's 5900 port, to connect to a VNC. Use this option if you would like to see the Docker container. For example, for debugging purposes. When you connect to the VNC client, use the password: PASSWORD Note: When running additional node containers on the same host, you must map each node container's 5900 port to a different host port. For example, use -p 5900:5900 for the first node, -p 5901:5900 for the second, -p 5902:5900 for the third, and so on.
   `--add-host=license-server:xx.xx.xx.xx` | Instructs the container which IP address to use for the UFT Developer license server. Replace xx.xx.xx.xx with your license server IP address.
   `"-e LFT_RUN_MODE="node"` | Instructs the container to run UFT Developer as a grid node.
   `-e LFT_GRID_PASSPHRASE="<encrypted passphrase>"` | Instructs the container what passphrase to use to connect to the grid.
   `-e LFT_GRID_NODE_NAME="<Node Name>"` | Specifies the name the grid uses to identify this node.
   `-e LFT_GRID_ADDRESS="ws://<IP address>:5095` Alternatively, map the grid host address: `--add-host=grid:<grid's IP address>` | Instructs the node container what address to use to access the grid container. You can do this by setting the LFT_GRID_ADDRESS environment variable or by mapping `grid` to the grid container's IP address. Note: When the environment variable is not set, a UFT Developer node looks for the grid at `ws://grid:5095`. If you want to use a different port number, you must set the environment variable.
   `<UFT Developer container>` | Instructs Docker to create a container. Possible values: functionaltesting/leanft, functionaltesting/leanft-chrome, functionaltesting/leanft-firefox. Optionally, append `:<version number>` to the container name. By default the latest version is used.

   Note:

   - If you use the leanft-chrome or leanft-firefox image, UFT Developer knows which browser the image contains and you do not need to define the browser capability on the node.
   - You can also use docker's -u <name|uid>[:<group|gid>] option to specify the user to use in the container.
3. After your containers are up and running, run your UFT Developer tests locally or remotely on the grid container. The grid distributes the tests to the relevant nodes, based on availability and the environment specifications you included in the tests.

Back to top

## Run the UFT Developer image with environment variables

Run the UFT Developer image with various environment variables to control how the container runs.

Prefix each variable that you run with -e. For example:

docker run -it -p 5900:5900 --add-host=license-server:xx.xx.xx.xx -e RUN_MODE=junit -e RUN_CMD="com.company.UFTDeveloperTest" -v <full path on the host’s machine to java jars>:/tests -w /tests <UFT Developer container>

The following table includes the environment variables, their description, and possible values.

Run commands

RUN_MODE | Determines how to run the container. | junit: runs a junit test using RUN_CMD s/sa/standalone: runs the container in standalone mode. c/custom: runs the command in RUN_CMD. Use along with RUN_CMD when you want to run a custom command.
RUN_CMD | Runs a command. | The command to run. Use this option when you want to run a custom command.
VERBOSE | Determines whether to print debug information. | true
LFT_SAPUI5_ADDIN | Indicates loading the SAPUI addin. | true
NOVNC | Indicates disabling the VNC session. The default is false. | true
USER_UID | If you run docker on Linux , we recommend that you pass your user ID in order to manage the test results files. | Your user ID
USER_GID | (Optional) If you run docker on Linux , pass your group ID to provide group permissions. | Your group ID

UFT Developer grid configuration

Supported in UFT Developer versions 15.0.2 and later.

LFT_RUN_MODE | Runs the container as a UFT Developer grid or a UFT Developer node. | grid, node. If you do not set this environment variable, the container runs an independent UFT Developer and not a grid.
LFT_GRID_PASSPHRASE | The encrypted case-sensitive passphrase that nodes must use when connecting to the grid. | Provide the same passphrase for the grid and the nodes that need to connect to it. Encrypt the passphrase using the docker container machine encryption. For example: `docker run -it leanft /opt/leanft/Tools/password-encoder -me <passphrase>`
Environment variables for the grid machine. See also Configure the grid's runtime engine settings.
LFT_GRID_MAX_LIC | The maximum number of concurrent licenses the grid is allowed to consume. | Maximum number of licenses
LFT_GRID_LIC_TIMEOUT | The license timeout for the grid. | License timeout
LFT_GRID_WAIT_TIMEOUT | The maximum number of seconds to wait for one of the locks on a relevant node to be released, if all nodes are currently in use and reached their lock maximum. | Node-wait timeout
Environment variables for grid node machines. See also Grid Connection Settings.
LFT_GRID_NODE_NAME | A unique name for the grid to use for this node. | A unique name
LFT_GRID_ADDRESS | The data needed for the node to connect to the UFT Developer grid machine. | Use the following format: `wss|ws://server-address:port number`. By default, `ws://grid:5095`. If you do not set this environment variable, make sure you map the grid host to the grid's IP address when running the node container.
LFT_GRID_NODE_MAX_LOCKS | The maximum number of simultaneous times the grid can choose this node for running a test. | Maximum number of locks

License

LFT_LIC_SERVER | The license server IP address or host name. Can be used instead of `--add-host=license-server:xx.xx.xx.xx` | The license server IP address or host name.
LFT_LIC_ID | The license ID that you want to use. The default is 20524. | license number
LFT_LIC_ID_VERSION | The license ID version. The default is 1. | version number

UFT Mobile

You must use all three environment variables.

LFT_HPEMC_ADDRESS | Use this variable along with LFT_HPEMC_USER and LFT_HPEMC_PASS to run UFT Mobile in the container. | The UFT Mobile IP address or host name.
LFT_HPEMC_USER | The UFT Mobile user name used for logging on. | The UFT Mobile user name.
LFT_HPEMC_PASS | The UFT Mobile password used for logging on. | An encrypted password using the docker container machine encryption. For example: `docker run -it leanft /opt/leanft/Tools/password-encoder -me <password>`
LFT_HPEMC_USE_PROXY | Indicates whether UFT Mobile runs behind a proxy. | True or False
LFT_PROXY_ADDRESS | The proxy IP address or host name. |

Proxy

Use these variables if you are running behind a proxy server.

http_proxy | Your organization's http proxy. | Host name or IP address and port
https_proxy | Your organization's https proxy. | Host name or IP address and port
no_proxy | Any address that does not require a proxy, such as you local host. | Host name or IP address and port

Back to top

See also:

- Execute your LeanFT tests in Docker

https://admhelp.microfocus.com UFT Developer 8942
Tips to improve your search results... UFT Developer Help Center UFT Developer Help 15.0-15.0.2 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: