Over a million developers have joined DZone.

How to Run a Taurus Test Through Jenkins Pipelines

DZone's Guide to

How to Run a Taurus Test Through Jenkins Pipelines

Using Jenkins to run your YAML test — which runs open-source load testing through Taurus — doesn't have to be difficult.

· DevOps Zone ·
Free Resource

Read why times series is the fastest growing database category.

Continuous Integration shortens time to release and ensures easy test configuration maintenance — but testing can be complicated. This blog post will go over how to run a load test through Taurus and any open-source tool and how to run those tests through Jenkins pipelines. This blog post is based on a webinar I co-presented with CloudBees and DevOps.com, which you can view here.

Taurus is an easy-to-use open source testing framework that works as a command line tool. Taurus simplifies load testing of 9 open-source load and functional testing tools: JMeter, Selenium, Gatling, The Grinder, Locust, Tsung, Siege, Apache Bench, and PBench. However, you don’t need to learn any of these tools’ complicated syntax. Rather, you can use Taurus’ intuitive YAML syntax instead. 

Taurus doesn’t support LoadRunner because LoadRunner isn’t an open-source tool. To learn more about converting your scripts from LoadRunner to open-source, see here

Creating a Taurus Script

First, install Taurus.

Then, create your script in YAML. Let’s look at this simple script:

- concurrency: 10
  hold-for: 5m
  ramp-up: 60s
  scenario: Thread Group
  Thread Group:
    - label: blazedemo
      method: GET
      url: http://blazedemo.com/
    - body:
        fromPort: Paris
        toPort: Buenos Aires
      label: reserve
      method: POST
      url: http://blazedemo.com/reserve.php

As you can see, it’s pretty easy to understand. This script runs 10 concurrent users and holds the load for five minutes. The ramp-up is 20 seconds and the thread group runs two requests: a GET request to blazedemo.com and a POST request to blazedemo.com/reserve.php.

Unless you specify an executor by adding a line that says executor: Gatling (for example), Taurus will use JMeter as the default executor. In the back, Taurus will create an artifact directory with a JMX file (or a Scala file if you run Gatling, a Python file if you run Selenium, etc.). If you have pre-configured scripts for your open-source tools, that’s OK. Just add a path to them in the script and add the test configurations within the YAML. 

You can also add pass/fail criteria. For example:

- module: passfail
  - avg-rt>10ms for 7s, stop as failed
  - hits of reserve >10 for 13s, continue as failed

In this case, if the average response time is more than 10ms for seven seconds, the test will stop as failed — or, if the number of hits is more than 10 for 13 seconds, the test will continue as failed. I created these parameters on purpose so the test will fail.

Now run the test by typing:

bzt <file_name>.yml <pass_fail_file_name>.bzt 

Viewing Taurus Results

You can quickly and easily see the test results on the Taurus dashboard. Note the failure alerts on the top right. 

taurus dashboard failure alerts

Viewing Taurus Results on BlazeMeter 

You can also view the test results on BlazeMeter. To do that, run:

bzt <file_name>.yml -report 

BlazeMeter will open up and you will be able to conduct a deeper analysis based on rich and colorful reports. BlazeMeter is a SAAS platform and you can also configure different geo-locations and higher concurrencies.

Here, for example, I configured engines to run from AWS Virginia and North California with 500 virtual users. 

blazemeter dashboard showing taurus test results

BlazeMeter offers different reports, which you can learn more about here.

Integrating Taurus With Jenkins

Taurus also integrates with Jenkins, and you can run the complete Taurus test from the Jenkins UI through Jenkins pipelines

After opening Jenkins, create a pipeline script. Here, I am pulling the YAML scripts from my GitHub repository and running the same command that I ran locally to run your Taurus test.

taurus test in jenkins pipelines

taurus test in github repository

To run the test in the cloud, modify the location parameters in the YAML script. You can also easily modify other configs, like concurrency or ramp-up. 

Jenkins can run these tests automatically. You can configure how the test runs in the build section. Here, for example, the test runs each time a change is pushed in GitHub; every time I change the concurrency, for example, the test will run again.

automating jenkins testing

You can see the results in Jenkins: 

viewing test results in jenkins

Or open the BlazeMeter link and see the results in BlazeMeter in real-time: 

viewing jenkins taurus test results in blazemeter

BlazeMeter also supports APM tools like New Relic, CloudWatch, and CA APM. You can configure them through BlazeMeter and they will run on your Taurus test. You will get the metrics in the BlazeMeter report.

blazemeter supports apm tools for the taurus test

pass failure criteria on blazemeter for taurus

That’s it! You now know how to use Jenkins to run your YAML test, which runs open-source load testing through Taurus. 

Learn how to get 20x more performance than Elastic by moving to a Time Series database.

devops ,taurus ,jenkins ,software testing ,pipelines

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}