How to Load Test with Gatling and Taurus
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 blog 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, which 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 + Plugins||Gatling|
|Scripting Approach||Simple GUI, fit for non-techies||Scala, requires coding skills|
|Hard to navigate through script||Easy to search through script|
|Not VCS-friendly||VCS friendly|
|Load Profiles||Supports arrival-based injections||Supports arrival-based injections|
|Supports hits/s and requests/s growth loads||Supports hits/s and requests/s growth loads|
|Community and Popularity||More popular||Less popular|
|Less skilled users||Higher-skilled users, found in larger organizations that hire technical specialists|
|More content, tools, integrations and services||Less content, tools, integrations and services|
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
- 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.
This test examines our blazedemo.com website. By using Gatling load testing tool, it tests 10 concurrent virtual users, with a ramp-up time of 30 seconds, the load is held then for 2 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 2 second think time before sending the requests, and asserts that the http code isn’t 200.
To run the test type
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 doesn’t require scripting, but it does generate a Scala file internally, which looks like this:
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, or you can run your Gatling tests directly through BlazeMeter. To learn more about BlazeMeter, request a demo, here.