Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: March 19, 2024
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.
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.
Keep in mind that we can’t use Jenkins without an initial users setup.
Let’s install the Performance plugin, which is necessary for running and displaying JMeter tests:
Now, we need to remember to restart the instance.
Now, let’s go to Jenkins home page and click on “create new jobs”, specify a name, select Freestyle project and click “OK”.


On the Execute shell Sub-tab we write a script to perform the necessary actions after the repository is cloned:
Here is the small corresponding shell script:
cd jmeter
./mvnw clean install -DskipTests
nohup ./mvnw spring-boot:run -Dserver.port=8989 &
while ! httping -qc1 http://localhost:8989 ; do sleep 1 ; done
jmeter -Jjmeter.save.saveservice.output_format=xml
-n -t src/main/resources/JMeter.jmx
-l src/main/resources/JMeter.jtl
As shown in the following image:
After the project is cloned from GitHub, we compiled it, opened on port 8989 and processed the performance tests, we need to make the performance plugin display result in a user-friendly way.
We can do that by adding a dedicated Post-build Actions. We need to provide the results source file and configure the action:
We choose the Standard Mode with the subsequent configs:

Let’s hit Save, on the left menu of Jenkins dashboard click on the button Build Now and wait for it to finish the set of operations we configured up there.
After it’s finished, we’ll see on the console all outputs of our project. At the end we’ll get either Finished: SUCCESS or Finished: FAILURE:

Let’s go to the Performance Report area accessible via the left side menu.
Here we’ll have the report of all past builds including the current one to see the difference in term of performance:

Let’s click on the indication just up of the table to have only the result of the last build we just made:

From the dashboard of our project we can get the Performance Trend, which are other graphs showing the last builds results:

Note: Applying the same thing to a Pipeline project is also simple as:
node {
stage 'Build, Test and Package'
git 'https://github.com/eugenp/tutorials.git'
dir('jmeter') {
sh "./mvnw clean install -DskipTests"
sh 'nohup ./mvnw spring-boot:run -Dserver.port=8989 &'
sh "while ! httping -qc1
http://localhost:8989 ; do sleep 1 ; done"
sh "jmeter -Jjmeter.save.saveservice.output_format=xml
-n -t src/main/resources/JMeter.jmx
-l src/main/resources/JMeter.jtl"
step([$class: 'ArtifactArchiver', artifacts: 'JMeter.jtl'])
sh "pid=\$(lsof -i:8989 -t); kill -TERM \$pid || kill -KILL \$pid"
}
}
This script starts by cloning the project, goes in the target module, compile and run it to make sure the app is accessible at http://localhost:8989
Next, we run JMeter tests located in the resource folder, save the results as the build output, and finally, the application is closed.
In this quick article, we have settled up a simple continuous delivery environment to run and show Apache JMeter tests in Jenkins in two ways; first via a Freestyle project and second with a Pipeline.
As always, the source code for this article can be found over on GitHub.