Skip to main content

How to Do Load Testing With Taurus and Gatling

 


By Hamid Al-qiari - Performance Test Lead  


Outline: 

  • Introduction

  • What Is Gatling?

  • Gatling vs. JMeter     

  • Gatling Cons

  • The Solution: Taurus for Gatling Users

  • How to Use Gatling With Taurus

  • Conclusion 


Gatling and JMeter have different features based on what you're looking for, but they're not without their disadvantages. Taurus can help fill in the gaps.

The open-source community often discusses whether to use JMeter or Gatling for load testing. Both are strong tools, and they become even stronger through Taurus. This post covers the differences between Gatling and JMeter and shows you how to run a Gatling test easily through Taurus


What Is Gatling?

Gatling is an open-source, cross-platform, load testing Java application that uses Scala scripting language. Gatling is a command line tool, i.e., it has no GUI or Web UI, which implies a certain level of technical knowledge for its users (unless you use it through Taurus, which we will discuss further on). 

Gatling enables its users to enjoy the full power of working with a programming language, without the limits of GUI DSL. It also has easy-to-use custom code pieces and extra libraries, flexible load-injection profiles, and an asynchronous concurrency model, which saves resource usage as one thread can serve many VUs and connections.




Gatling vs. JMeter

While Gatling and JMeter have different features, we don’t recommend one over the other. Rather, they are both strong and have similar abilities (when JMeter is used with its plugins). Therefore, it’s up to you to choose which one you prefer and like to work with.




JMeter

Gatling



Community and popularity

More popular

Less skilled users


More content, tools, integrations, and services

Less popular

Higher-skilled users; found in larger organisations that hire technical specialists

Less content, tools, integrations, and services



Scripting approach

Simple GUI; fit for non-techies

Hard to navigate through script


Not VCS-friendly

Scala; requires coding skills


Easy to search through script


VCS-friendly 



Load profiles

Supports arrival-based injections

Supports hits' and requests' growth loads

Supports arrival-based injections


Supports hits' and requests' growth loads



Gatling Cons

While Gatling is a powerful tool, it has a few disadvantages:

  • Not for beginners. The larger number of prerequisites and high technical skills that are needed make it hard to use for beginners.

  • No real-time reports. Rich real-time reports are crucial for load testing nowadays. Developers need to be able to run a test and analyze the results immediately.

  • No reports storage. Reports aren’t collaborative, can’t be shared between team members and can’t be analyzed over time to identify KPI trends. This is true for JMeter as well.

  • No distributed testing. Tests can be run only on your local machine. JMeter has limited distributed testing.

  • Slow startup time (especially for complex scripts).

 

The Solution: Taurus for Gatling Users

Taurus is an open-source automation load testing tool that fills in the existing gaps in JMeter, Selenium, and Gatling. Gatling users can run Taurus and gain the advantages of both.

Here’s how:

  • Simplified scripting. Taurus scripts are very easy, and even a list of URLs is enough to start running a load test. Users can use Gatling without having to learn Scala or understand the Gatling file layout, load profile specifications or other requirements.

  • Automation. When you run tests every day, any second you lose becomes a problem. Taurus makes everyday usage convenient by automating tests and by integrating with Continuous Integration tools like Jenkins.

  • Reporting and scaling capabilities. Taurus answers modern requirements and extends existing open-source tools capabilities by providing rich real-time reports. With BlazeMeter (no payment required) these reports are also stored. Storage abilities enable developers to conduct KPIs analysis over time over complex correlations.

  • Heterogeneous testing. Taurus enables easily running Gatling and Selenium at the same time. This way, developers can generate the backend load test and track the front-end user experience at the same time.

How to Use Gatling With Taurus

First, install Taurus 

Before Taurus and after Python installation, check if you have the following modules installed:

pip install --upgrade wheel setuptools Cython

The simplest Taurus installation requires you to use pip package manager:

pip install bzt

and for upgrade:

pip install --upgrade bzt

Keep in mind that some additional software can be required depend on the test type (Java, specific Python tools like Locust, etc.). Below you can see some specific info for different operating systems.

Unstable features

We use the following mark

This is available only in unstable snapshot.

for the features that will be released soon but at the moment can't be installed from PyPi and available in the pointed topic only.

Linux

You will need Python 3.7+ and Java installed. To install Taurus on Linux, do the following instructions:

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

Upgrading to latest is as simple as this:

sudo python3 -m pip install --upgrade bzt

Alternatively, you can install using virtualenv, and you won't need sudo privileges for Taurus. Please see virtualenv instructions for setting up your Python virtual environments, if you haven't done so already.

Then, to install Taurus, type:

pip install bzt

Upgrade is simply:

pip install --upgrade bzt

Mac OS

Install Homebrew Package

You can use brew package manager to install Taurus:

brew install bzt

and to update it:

brew upgrade bzt

If your brew auto update is switched off don't forget to manage it manually.

NOTE: There is an issue with brew installation connected with numpy. In order to avoid this problem we suggest installing Taurus using pip tool.

To install Taurus with pip you need command line developers tools and Python 3.7+ installed. Then you need to install Cython if it is not installed using the following command:

pip3 install Cython

Then just install bzt:

pip3 install bzt

To upgrade, use:

pip3 install --upgrade bzt

Windows

Preparation steps:

  1. Get Python 3.7+ from http://www.python.org/downloads and install it, don't forget to enable "Add python.exe to Path" checkbox.

  2. Get the latest Java from https://www.java.com/download/ and install it.

  3. Get the latest Microsoft Visual C++ and install it.

Please check that the 'Desktop Development with C++' box is checked during installation.

Also, do not forget to update pip, setuptools, and wheel with the following command:

python -m pip install --upgrade pip setuptools wheel

After all those steps, install Taurus:

python -m pip install bzt

 

Now, create a configuration file. The Taurus configuration file has two parts: the execution and the scenarios.

For example: 

execution:
- executor: gatling
  scenario: blazedemo
  concurrency: 10
  ramp-up: 30s
  hold-for: 2m

scenarios:
  blazedemo:
    default-address: blazedemo.com
    headers:
      X-Tracking: false
      Accept: "*/*"
    requests:
    - url: /
      headers:
        Accept: text/html
      assert:
      - contains:
        - " .+sometext.+"
        subject: body
        regexp: true
        not: true
    - url: /reserve.php
      method: POST
      body: 'Some Body Data'
      think-time: 2s
      assert:
 

- contains:
        - 200
        subject: http-code
        not: true

 

This test examines the Blaze demo website. By using the Gatling load testing tool, it tests 10 concurrent virtual users , with a ramp-up time of 30 seconds, the load is held then for two minutes. The test specifies GET requests with asserts it to include word “sometext,” and then sends a POST request to blazedemo/reserve.php with Some Body Data in the body, defines a two-second think time before sending the requests, and asserts that the HTTP code isn’t 200.


To run the test type:  

bzt gatling-req.yml 


Taurus will show you KPI results in real-time, as fast as they appear on Gatling. KPIs include latency times, response codes, percentiles, etc. 

Taurus running Gatling dashboard

Taurus doesn’t require scripting, but it does generate a Scala file internally, which looks like this:

Scala file on Taurus

As you can see, Taurus scripting language is easy, and it is much easier than Scala. It also enables you to go back, interrupt the test and edit the file, if you need to.

You can also view the reports of your Taurus test on BlazeMeter without having to sign up for BlazeMeter. Just add -report to your command line, and CA BlazeMeter will open up with statistics, KPI correlations, timeline reports, etc. These reports can be shared between team members. 

 

 

 

Congratulations! You can now easily run Gatling through Taurus and view report results on BlazeMeter. 



Comments

Popular posts from this blog

Handling CSRF Tokens in JMeter: A Comprehensive Guide

By Hamid Al-qiari - Performance Test Lead   Handling CSRF Tokens in JMeter What is CSRF Token A CSRF Token is a secret, unique and unpredictable value a server-side application generates in order to protect CSRF vulnerable resources.    The tokens are generated and submitted by the server-side application in a subsequent HTTP request made by the client.   After the request is made, the server side application compares the two tokens found in the user session and in the request. If the token is missing or does not match the value within the user session, the request is rejected, the user session terminated and the event logged as a potential CSRF attack. When do you need  CSRF token with JMeter  We need a CSRF token during the load test. Actually, the CSRF token is generated at run time and can be used only once, so if you use its hard-coded value in your script  then your run will fail, because that is a used token and is no longer valid for use. ...

How to Integrate a JMeter Load Test Into Bamboo CI Server

  By Hamid Al-qiari - Performance Test Lead  How to Integrate a JMeter Load Test Into Bamboo CI Server   We all know that periodic load tests are vital if you want to avoid unpleasant surprises and regressions. Therefore, in this fast-paced agile age, it’s becoming increasingly important to integrate load testing into your continuous integration process. Including load testing in your application build process will allow you to:  Catch performance regressions early Understand the impact of adding new features on your application’s performance Catch performance issues when versions of the underlying dependencies change Deploy with confidence This blog post will explore this integration process further with a Bamboo continuous integration tutorial, where we will show you how to integrate load tests from Apache JMeter into Atlassian's Bamboo. What is Atlassian Bamboo? Atlassian Bamboo is one of the most popular continuous integration, release and build servers around...

How to use CloudWatch with Performance Testing

By Hamid Al-qiari - Performance Test Lead   How to Use AWS CloudWatch for Performance Testing AWS CloudWatch is an observability tool by Amazon that enables monitoring the performance of applications, services & infrastructure resources deployed on AWS, as well as on hybrid and on-premises environments. When performance testing , observability tools like AWS CloudWatch can help extend our visibility and show us the server-side of application performance. This will help us complement our performance tests.  In this blog post, we will explore the insights and metrics provided when performance testing and how server-side metrics, with AWS CloudWatch, can help us improve our application’s performance. Table of Contents: Why Use AWS CloudWatch as Part of Performance Testing?  How to Use AWS CloudWatch During Your Performance Test Using the AWS CloudWatch Console Why Use AWS CloudWatch as Part of Performance Testing?  When performance testing, testers, developer...