Run UFT tests in a Docker container

Use a UFT Docker image to speed up UFT maintenance and test runs.

UFT's Docker image enables you to run web or mobile tests in a Docker environment, using a locally installed version of Mobile Center or StormRunner Functional on the cloud, and UFT automation scripts.

Supported in UFT versions 14.51 and higher.

Install the Docker container

Install the Docker container by running the following command:

docker pull functionaltesting/uft[:tag] //Add [:tag] to specify a UFT image version

where [:tag] is an optional flag to add for a specific UFT image version.

Back to top

Configure the Docker container for your use

Once installed, perform the following UFT configurations:

Install a concurrent license

UFT's Docker image is supported for concurrent licenses only. For more details, see Seat vs. concurrent licenses.

Configure connections to other Micro Focus products

Configure connections to the following, as needed:

  • Mobile Center, to run mobile tests on a locally installed version of Mobile Center. For details, see Set up UFT for mobile testing.
  • StormRunner Functional, to upload web or mobile tests to SRF, or to run or record tests remotely in SRF's lab. For details, see the SRF Help Center.

Back to top

Create a UFT automation script with Mobile Center or SRF commands

Running UFT tests on your Docker container is done via a UFT automation script that contains the specific objects and methods required to run your tests in Mobile Center or SRF.

The following is a sample script used to run a specific test in SRF.

Dim 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 UFT

qtApp.Visible = False ' Make the UFT application visible

qtApp.Options.SRFConnection.Server = “<SRF server>”

qtApp.Options.SRFConnection.ClientSecret = "<SRF client secret>"

qtApp.Options.SRFConnection.ClientID = "<SRF client ID>"

qtApp.Options.SRFConnection.ShowRemoteWndOnRun = False

qtApp.Options.SRFConnection.UseProxy = True

qtApp.Options.SRFConnection.ProxyServer = "<Proxy server>"

qtApp.Options.SRFConnection.ProxyPassword = ""

qtApp.Options.SRFConnection.ProxyUser = ""

qtApp.Options.SRFConnection.ProxyType = "HTTP Proxy"

qtApp.Options.SRFConnection.ProxyUseAuthentication = False

qtApp.Open "<UFT script path>", True '

qtApp.Test.Settings.Launchers("Web").Active = True

qtApp.Test.Settings.Launchers("Web").SetLab "SRFDesktopBrowser"

qtApp.Test.Settings.Launchers("Web").SRF.Browser = "Chrome 69"

qtApp.Test.Settings.Launchers("Web").SRF.OS = "Ubuntu 16.04"

qtApp.Test.Settings.Launchers("Web").SRF.Resolution = "1920x1080"

Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object

qtResultsOpt.ResultsLocation = “<HTML report path>”

Set qtTest=qtApp.Test

qtTest.Run qtResultsOpt ' 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 SRF server, client ID, and secret placeholder text with the values from your SRF tenant.

For more details, see:

Back to top

Run your UFT automation script in the Docker container

Run your UFT tests in your Docker container using a UFT automation script with steps to run your test in Mobile Center or SRF.

Do the following:

  1. Prepare your automation script. For details, see Create a UFT automation script with Mobile Center or SRF commands.

  2. In your Docker container, run:

    docker run -it --name <container-name> -v <host-dir>:<container-dir> functionaltesting/uft:[:tag] cmd //Add [:tag] to specify a UFT image version

    cd <container-dir>

    <script-name>.vbs //Run the AOM script

    where:

    Parameter name Description

    <container-name>

    The name of your Docker container
    <host-dir>

    The name of the host directory on the machine where the automation script is stored.

    This directory is mounted to the <container-dir> location on your Docker container.

    <container-dir> The name of the directory on your Docker container where the <host-dir> is mounted.
    <script-name> The name of the UFT automation script configured to run your UFT tests.

    Note: Include the optional [:tag] for a specific UFT image version.

Your tests are run as configured.

Back to top

See also: