How to Execute a Load Test Using the Taurus Docker Image
Containers are virtual “boxes” inside machines that run the programs installed on them (and only the programs installed on them) in an isolated environment. Using containers enables you to know exactly which tools and plugins you are running and testing, and avoid dependency issues with other tools/versions on your machine. In addition, you can easily create multiple containers with different tools/versions, enabling you to draw comparisons.
Containers make your work faster, more accurate and let you focus only on what you want to work on. They are also very efficient because they take only a little memory or CPU from your machine.
To run a container you need an image. Images are snapshots, which are essentially running instructions. You can develop and run containers through platforms like Docker.
Now let’s say you want to automatically run a load test and analyze the results in a containerized environment. What should you do? Taurus, an open-source test automation tool, has a Docker image, which contains all the tools and plugins needed to run a Taurus test in an isolated environment.
Please note that this is a blog post for users who are already familiar with Taurus. You are welcome to read more about the system here.
How to run the Taurus Docker Image
2. Run this Docker Pull Command:
in your machine terminal. This command will pull the blazemeter/taurus image from the Docker hub into your local machine.
The complete list of tools that the Taurus Docker image contains is listed in the Dockerfile tab at https://hub.docker.com/r/blazemeter/taurus/~/dockerfile/. It includes everything you need in order to run a Taurus test, with all of its supported executors (including browsers for Selenium and additional tools).
You can make sure the Taurus image is installed by running the ‘docker images’ command. If the installation worked you should see the blazemeter/taurus image listed as a repository.
3. Create two folders on your computer: one to store all of your YAML configs and additional files like JMX files, and another empty one for the future artifacts.
4. Add the path to the two folders you created in step 3 in the Docker ‘file sharing’ configuration. This is important for getting the logs of the test, into the artifacts folder you created.
When the test runs inside the container, adding the folder path will make sure the test logs can be copied to your host, outside of the container where the test ran.
If you are using Docker for Mac/Windows, you can do this by using the Docker UI on the ‘Preferences’ => ‘File Sharing’ tab.
For Ubuntu, see instructions here.
5. To run your YML script/s using the Taurus-Docker image, run the following command:
This command will run the script you placed in your ‘scripts’ folder, through Taurus. The logs will be copied into the artifacts directory you created.
That’s it! You can now see the test results in the artifacts directory you created.
To learn more about continuous testing for containerized applications, check out this free webinar.