Running an AFT suite in a containerized workbench and agents by using Docker Compose

You can run an Accelerated Functional Test (AFT) suite in a containerized workbench and agents after you deploy your Docker images. You can use the Docker Compose tool to run an AFT suite and need not install the workbench or the agents on different computers.

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 the tests on containerized agents, you must load the agent image into the Docker repository by running the following command:
    docker load -i <agentImageName>

    For example, the agent image name could be ibm-rtw-<versionNumber>.tar.gz.

    When the agent image is loaded into the Docker repository, the following message is displayed:
    - Loaded image: imageFileName:versionNumber
  3. From the workbench, create an AFT Suite that lists all the agents that are used for the distributed run of multiple tests on multiple agent locations.
  4. To run an AFT Suite, you must initiate a run in which the Docker container agents are automatically connected to the workbench container. To do this, install the Docker Compose tool and complete the following steps:
    1. Create docker-compose.yml according to the following sample:
      Sample compose file:
      #SIMPLE DOCKER COMPOSE FILE/TEMPLATE
      #BE SURE TO REPLACE ANY PROJECT-SPECIFIC NAMES/PATHS AND LICENSING VARIABLES WITH YOUR OWN VALUES
      version: '2'
      services:
        agent1:
          image: <agentImageName>:<imageVersion>
          environment:
            - MASTER_NAME=<workbenchImageName>
            - AGENT_NAME=<agentImageName>
          
        agent2:
          image: <agentImageName>:<imageVersion>
          environment:
            - MASTER_NAME=<workbenchImageName>
            - AGENT_NAME=<agentImageName-2>
          
        workbench:
          image: <workbenchImageName>:<imageVersion>
          entrypoint: cmdline -workspace /runData/workspace -project projectName -aftsuite AFTSuiteName -results autoResults -stdout -exportlog /runData/agentlog.txt -exportReport "type=unified;format=html;folder=rundata;filename=report"
          ports:
               - "7080:7080"
               - "7443:7443"
          volumes:
            - C:\Tests:/Tests
            - C:\runData:/runData
          environment:
            - RATIONAL_LICENSE_FILE=27000@<IP> 
           
            - TEST_IMPORT_PATH=/Tests/Project.zip
      Notes:
      • You must replace the values in italics in the sample compose file with values according to your environment.
      • Docker Compose tool is included with some versions of Docker. The tool automates some network configurations and makes it easier to coordinate multiple containers. To check whether you already have Docker Compose, you can run the command, docker-compose --version.
  5. Verify whether the run is completed successfully. If you have used an option such as -exportlog to generate results to a shared volume, check the directory in your host computer that was mapped to hostImportedData and retrieve the exported data.
  6. To stop the agents when the workbench container exits, run the following command:
    docker-compose up --abort-on-container-exit
    Table 1.
    Command Description
    MASTER_NAME Specifies the name of the workbench image.
    AGENT_NAME Specifies the name of the agent image.
    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.
    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 that you specify on the host computer.

    <agentImageName>:<imageVersion>

    Specifies the name of the agent image and its version to run.
    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/ProjectName.zip. The volume and path names are user-defined and must be consistent.
    workbenchimageName:imageVersion Specifies the name of the workbench 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