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"

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 could 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
      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

      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
    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
      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
    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 location of the workspace, project name, test name, results file name, and the location of the exported logs.

What to do next

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