Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Load Test With Gatling and Taurus

DZone's Guide to

How to Load Test With Gatling and Taurus

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.

· Performance Zone
Free Resource

Download our Introduction to API Performance Testing and learn why testing your API is just as important as testing your website, and how to start today.

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. This blog post is based on the webinar “Load Testing at Scale Using Gatling and Taurus,” which you can view for free here.

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 reports

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 + plugins Gatling
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
Community and popularity More popular

Less skilled users

More content, tools, integrations, and services
Less popular

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

Less content, tools, integrations, and services

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 (which is awesome so it installs Gatling for you). 

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. 

Running Gatling through Taurus, BlazeMeter reports

Running Gatling through Taurus, BlazeMeter reports

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

Find scaling and performance issues before your customers do with our Introduction to High-Capacity Load Testing guide.

Topics:
performance ,load testing ,gatling ,taurus ,jmeter ,tutorial

Published at DZone with permission of Noga Cohen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}