Load and stress web testing with Taurus

Introduction

There are plenty of tools to test your web performance, each of them have their pros and cons and besides that you probably will end up choosing whichever you already know and you feel more comfortable with.

In this post we would like to write about a tool we have recently known. That is Taurus

What is Taurus?

I guess that we can define Taurus as a performance testing framework that is here to help you to write your performance tests scripts in a more user-friendly manner than the usual JMeter or Selenium scripts. This is done by creating a yaml file, which can be as simple or as complex as you want or need. You can even execute existing JMeter or Selenium scripts, so you can imagine how powerful your test can be.

It’s open source and it has been developed by the creators of Blazemeter.

Browser plugin

There is the Blazemeter plugin which is available for Chrome and you can use it to record your browsing session. Press the button to start, and just navigate through your website so you can simulate this session in your tests.

record test

You can download the session as a jmeter or selenium script. And even as a taurus script so you don’t need to write a line of code.

export script

Installation

First of all, depending on your resources and tests requirements you can install Taurus on your computer or on a server. There are multiple methods but we will show you the two we consider better.

If you are in a hurry or you just don’t have another machine at your disposal, you can just use the Taurus Docker image.

On the other hand, if you need to perform resource demanding tests or if you will need to run tests on a regular basis, you probably should install Taurus on a server in your favorite cloud provider. In this case I would recommend to use the repository instead, since you will probably want to make the best use of your machine resources.

Docker install

As I said previously this would be my preferred method for my computer install. You probably have docker installed on your system so you just need to run:

docker pull blazemeter/taurus

Python packet manager

sudo apt-get update

sudo apt-get install python3 default-jre-headless python3-tk python3-pip python3-dev 

  libxml2-dev libxslt-dev zlib1g-dev net-tools

sudo python3 -m pip install bzt

Performing the tests

Depending on the installation method you shall run either the command-line tool or docker to perform the tests.

  • bzt my_test.yml
  • docker run --rm -v :/bzt-configs -v :/tmp/artifacts blazemeter/taurus my_test.yml

Anyways, the important part is in the yaml file where the test declaration and configuration resides. A simple yaml could look like this:

execution:
- concurrency: 10
  ramp-up: 1m
  hold-for: 5m
  scenario: quick-test

scenarios:
  quick-test:
    default-address: https://myweb.com
    think-time: 3s
    keepalive: true
    requests:
    - /test.php
    - /anotherpage.php

This will run a test for 5 minutes with 10 simulated users (or threads) who will perform two requests with a 3-second delay between each request. During the test you can watch an UI interface to follow the test.

taurus console

But the best part are the online reports. You can get an interactive html report which will be uploaded to blazemeter web just by adding this to the yaml.

reporting:
- module: blazemeter
  report-name: My test
  test: Taurus  test
  project: My web
  upload-artifacts: false  # upload artifacts when test is finished

At the end of the test you will get a web address and your report should look like this:

online report

As previously mentioned, you can run existing JMeter scripts, the configuration syntax would be like this:

execution:
- concurrency: 10
  ramp-up: 1m
  hold-for: 5m
  scenario: jmeter sample

scenarios:
 jmeter sample:
    script: tests/jmx/session1.jmx

Of course you can run multiple scenarios in the same test, or even run them in multiple machines in parallel. But we may save this and maybe other more advanced topics for another post.

Conclusion

Taurus is a powerful and flexible web test framework and I hope that you have had a glimpse of that in this post. It’s hard to think of a test scenario which Taurus can’t be of use, you can perform very complex web tests but also you can perform easily the most basic, you can even use the chrome plugin to get the configuration file made for you if you don’t want to write a line of code, although the configuration file syntax it’s easy and intuitive to learn.

And to conclude, if you have any doubt about this subject or just need our services, just check our website and contact us, we will be very happy to assist you!

Leave a Reply

Your email address will not be published. Required fields are marked *