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

How to Easily Automate Performance Tests in Jenkins

DZone's Guide to

How to Easily Automate Performance Tests in Jenkins

JMeter is one of the most popular and powerful open-source load testing tools. However, the JMeter script can be hard to manage.

· DevOps Zone
Free Resource

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

JMeter is one of the most popular and powerful open-source load testing tools. However, the JMeter script can be hard to manage. A simple request can turn into 100+ unreadable lines, and changes can be made only through JMeter.

Load Testing with JMeter

An easier solution is Taurus, an open-source test automation tool based on YAML that simplifies the Continuous Integration (CI) processes. Scripts on Taurus are easy to create, understand, and change.

How to Easily Create a Test in Taurus

Let’s look at this example—but before you do, take a minute to install Taurus.

modules:
 blazemeter:
   test: Taurus Demo 
scenarios:
 simple:
   requests:
   - label: HomePage
     url: http://blazedemo.com/
   - label: VacationPage
     url: http://blazedemo.com/vacation.html
services:
- module: passfail
 criteria:
 - avg-rt of HomePage>750ms for 10s, continue as failed 
execution:
 scenario: simple
 hold-for: 5m
 concurrency: 250
 ramp-up: 120s
  • This script, only 23 lines long, includes two endpoints: HomePage and VacationPage.
  • This test has an automated threshold. If the average response time of the HomePage is more than 750ms for 10 seconds, the test should be marked as failed.
  • The test also includes execution instructions: hold for five minutes, for 250 virtual users, with a ramp-up of 120 seconds.

Making Changes in the Load Test Script

It’s easy to make changes to this script. 

1. Change the value on Taurus. In this case, we changed the ramp-up to 90 seconds.

modules:
 blazemeter:
   test: Taurus Demo
scenarios:
 simple:
   requests:
   - label: HomePage
     url: http://blazedemo.com/
   - label: VacationPage
     url: http://blazedemo.com/vacation.html
services:
- module: passfail
 criteria:
 - avg-rt of HomePage>750ms for 10s, continue as failed
execution:
 scenario: simple
 hold-for: 5m
 concurrency: 250
 ramp-up: 90s

To run this YAML script with Taurus, simply run bzt example.yml from the command line. Click here to learn more about working with Taurus.

2. Go to the file in the GitHub repository and commit the change.

Testing in Jenkins

3. Go to Jenkins. GitHub triggered a test in Jenkins, and you can see the test is kicked off. For more information about the GitHub Jenkins plugin, see here.

GitHub Jenkins Plugin

The change is easily made without having to use a heavy GUI product. This works for app and code changes, as well.

You can see if the test failed by clicking on the test itself. The reason is shown in the test name. In this case, average response time was greater than 750ms.

Jenkins Tests

Viewing Load Test Reports on BlazeMeter

The data from Taurus is automatically fed into BlazeMeter. BlazeMeter reports show multiple KPIs and correlations.

Type –report to open BlazeMeter.

Load Test Reports with BlazeMeter

BlazeMeter and Taurus enable quality automation. Not only are the load tests automated, but users can get feedback in real-time and analyze bottlenecks and issues, enabling them to make the necessary fixes ahead of time. 

We recommend that you also add functional tests to Jenkins and use tools like Sauce Labs to test browsers and operating systems.

Congratulations! You can now easily automate performance tests in Jenkins. Click here to go to Taurus and learn more.

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

Topics:
taurus ,jenkins ,devops ,jmeter

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 }}