Jenkins – JMeter Integration

The goal of Jenkins – JMeter Integration is to make performance testing a natural part of the lifecycle of any development project. In this article, we will see how to integrate our open source JMeter performance tests into open source Continuous Integration tool Jenkins

What is Jenkins?

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed

Integration Overview

In this article, we’re going to configure a continuous delivery pipeline using Jenkins and Apache JMeter.

We’ll rely on the JMeter article as a great starting-point to first understand the basics of JMeter, as it already has some configured performance tests we can run. And, we’ll use the build output of that project to see the report generated by the Jenkins Performance plugin.

Setting up Jenkins

First of all, we need to download the latest stable version of Jenkins, navigate to the folder where our file is and run it using the java -jar jenkins.war command.

Installing the Performance Plugin

Let’s install the Performance plugin, which is necessary for running and displaying JMeter tests:

Jenkins - JMeter Integration

Now, we need to remember to restart the instance.

Run JMeter Tests With Jenkins

Now, let’s go to Jenkins home page and click on “create new jobs”, specify a name, select Freestyle project and click “OK”.In the next step, on the GeneralTab, we can configure it with these general details:

Jenkins - JMeter Integration

Next, let’s set the repository URL and branches to build:

Jenkins - JMeter Integration

Now go to the BuildTab to specify how we’ll build the project. Here instead of directly specified the Maven command to build the whole project, we can take another way to better have the control of our pipeline as the intent is just to build one module.

On the Execute shellSub-tab we write a script to perform the necessary actions after the repository is cloned:

  • Navigate to the desired sub-module
  • We compiled it
  • We deployed it, knowing that it’s a spring-boot based project
  • We wait until the app is available on the port 8989
  • And at the end, we just specify both the path of our JMeter script (located inside the resource folder of the jmeter module) to use for performance testing and the path of the resultant file (JMeter.jtl) also in the resource folder

Here is the small corresponding shell script:

As shown in the following image:

Jenkins - JMeter Integration

Pages: 1 2