Running tests in a containerized workbench

You can run tests in a containerized workbench after you deploy your Docker images. You need not install the workbench on your computer to run your tests.

Before you begin

  • You must have configured a Docker container.
  • You must have exported test assets to a location from where Docker can import them.
Notes:
  • You must use a Bash shell to run the commands for executing tests. In Windows operating system, you can use Git Bash.
  • The version number of the container images and the desktop products must match. If you have a previous version of the container image, you must uninstall it and then install the current version. To uninstall the image, you must use the following commands:

    To stop the container:

    docker stop "CONTAINER ID"

    To uninstall the image:

    docker rmi -f "image ID"
Restriction: If you run the test script for an HTML application as part of a compound test and in the headless mode in Docker, the inputKeys action for some special keys might not work. For example, in Firefox, the inputKeys action does not work for arrow keys.

Procedure

  1. Run the following command to load the workbench image into the Docker repository:
    tar --wildcards --to-command='docker load' -xzf <workbenchImageName> 'images/'* 

    For example, workbenchImageName can be ibm-rtw-<versionNumber>.tar.gz.

    When the workbench image is loaded into the Docker repository, the following message is displayed:
    -Loaded image: imageFileName:versionNumber
  2. To run tests on the Docker environment without using any agents, complete the following steps:
    1. Select the required test from the workbench and export it by using the Test Assets with Dependencies option. You can use this exported test asset to run on Docker environment.
    2. To run a Web UI test or compound test, start the container by running the following command:
      $docker run --rm -e RATIONAL_LICENSE_FILE=PORT@HOST   -v hostTestAssets:/containerTestAssets -v hostImportedData:/containerImportedData -e TEST_IMPORT_PATH=/containerTestAssets/testasset.zip  imageName:imageVersion cmdline -workspace /containerImportedData/workspace -project projectName -suite TestSuiteName -results autoResults -stdout -exportlog /containerImportedData/testlog.txt -exportReport "type=unified;format=<html, xml, or pdf>;folder=runData;filename=report"
      For example, on Windows host:
      $docker run --rm -e RATIONAL_LICENSE_FILE=27000@10.116.15.89 -v C:\TestAssets:/test -v C:\TestExecutions:/runData -e TEST_IMPORT_PATH=/test/Project.zip ibm-rtw:10.0.2 cmdline -workspace /runData/workspace -project MyRFTProject -suite Tests/WebUITest.testsuite -results autoResults -stdout -exportlog /runData/logs/WebUItestlog.txt -exportReport "type=unified;format=html;folder=runData;filename=WebUIreport"

      For example, on Linux host:

      $docker run --rm -e RATIONAL_LICENSE_FILE=27000@10.116.15.89 -v /home/user/TestAssets:/test -v /home/user/TestExecutions:/runData -e TEST_IMPORT_PATH=/test/Project.zip ibm-rtw:10.0.2 cmdline -workspace /runData/workspace -project MyRFTProject -suite "Compound Tests/CompoundTest.testsuite" -results autoResults -stdout -exportlog /runData/logs/CompoundTesttestlog.txt -exportReport "type=unified;format=html;folder=runData;filename=CompoundTestreport"
    3. To run an Accelerated Functional Test suite, start the container by running the following command:
      $docker run --rm -e RATIONAL_LICENSE_FILE=PORT@HOST  -v hostTestAssets:/containerTestAssets -v hostImportedData:/containerImportedData -e TEST_IMPORT_PATH=/containerTestAssets/testasset.zip  imageName:imageVersion cmdline -workspace /containerImportedData/workspace -project projectName -aftsuite AFTTestSuiteName -results autoResults -stdout -exportlog /containerImportedData/testlog.txt -exportReport "type=unified;format=<html, xml, or pdf>;folder=runData;filename=report"
      For example:
      $docker run --rm -e RATIONAL_LICENSE_FILE=27000@10.116.15.89 -v C:\TestAssets:/test -v C:\TestExecutions:/runData -e TEST_IMPORT_PATH=/test/Project.zip ibm-rtw:10.0.2 cmdline -workspace /runData/workspace -project MyRFTProject -aftsuite MyAFTSuite.XML -results autoResults -stdout -exportlog /runData/logs/AFTSuiteTestlog.txt -exportReport "type=unified;format=html;folder=runData;filename=AFTreport"
    Table 1.
    Command Description
    --rm Removes the container after the run is completed.
    -e Sets the environment variables.
    RATIONAL_LICENSE_FILE=<PORT>@<HOST> Specifies the port number of Rational License Key Server, usually 27000, and the server IP address. The floating license for the product and VT-packs must be on the license server.
    hostTestAssets:/containerTestAssets Specifies the folder location on the host computer and the container that contains the compressed test assets (.zip format). You must use both the locations to map one or more shared volumes to transfer data such as test assets, logs, and execution results between the host and the container.
    hostImportedData:/containerImportedData Specifies the workspace location on the host computer and the container that contains the test assets that are not compressed. The results of the test execution are saved to the directory you specify on the host computer.
    TEST_IMPORT_PATH=<PATH> Specifies the location of the compressed test assets to be imported into the container. The location path is on the container side and not the host. For example, /containerTestAssets/archiveName.zip. The volume and path names are user-defined and must be consistent.
    imageName:imageVersion Specifies the name of the image and its version to run.
    cmdline
    Specifies the existing command-line arguments to define the following details:
    • Location of the workspace
    • Project name
    • Test name
    • Results file name
    • Location of the exported logs
    • Unified report format
    • Location of the unified report
    • Unified report file name

What to do next

When the test run is completed, you can check hostImportedData in the host computer to view the exported log.