Example: Running Tests on Google Chrome

This topic provides an example of how you can use Docker containers to run a Silk4J test set on Google Chrome on a Linux machine with Apache Ant. Before you can run the test set, you have to perform the following tasks:
  • Install Docker on your machine.
  • Prepare your Silk4J project for executing tests with Ant. For additional information, see Replaying Tests with Apache Ant.
  • Copy the project to your Linux machine, for example to /home/<user name>/projects/InsuranceWeb.
To run the Silk4J test set on Google Chrome.
  1. Pull the latest version of the involved images to your registry. For our example, we need the following three images:
    • The latest Silk Test image.
      docker pull functionaltesting/silktest:latest
    • The latest Google Chrome image.
      docker pull selenium/standalone-chrome:latest
    • The Ant container that should run the tests.
      docker pull webratio/ant:latest
  2. Create a virtual Docker network to enable the Docker containers to communicate with each other. For our example, name the network my-network.
    docker network create my-network
  3. Start the Google Chrome Docker container.
    docker run --network my-network --name chrome selenium/standalone-chrome:latest
  4. Start the Open Agent Docker container.
    docker run -e SILK_LICENSE_SERVER=<license-server address>
      -e SILK_LOG_FILE_PATH=/logs
      -v /home/<user name>/projects/logs:/logs
      --network my-network
      --name agent
    For additional info on the available environment variables, see Silk Test Image Environment Variables.
  5. Start the Ant Docker container to run the tests.
    docker run -v /home/<user name>/projects/InsuranceWeb:/tmp/project
      --network my-network
      -it webratio/ant:1.10.1 ant
        -Dsilktest.configurationName="host=http://chrome:4444/wd/hub;platformName=Linux - Chrome"
        -buildfile /tmp/project/build.xml runTests
  6. View the test results under /home/<user name>/projects/logs.
  7. Optional: To cleanup your test environment, execute the following commands:
    • Stop the Open Agent Docker container.
      docker stop agent
    • Stop the Google Chrome Docker container.
      docker stop chrome
    • Remove the Open Agent Docker container.
      docker rm agent
    • Remove the Google Chrome Docker container.
      docker rm chrome
    • Remove the Ant Docker container.
      docker rm test-runner
    • Remove the virtual network.
      docker network rm my-network