Running JMeter Performance Tests on Jenkins

Areesha Altaf
DevOps.dev
Published in
4 min readNov 14, 2023

--

Image from https://engagedly.com/

Any internet user can attest to how frustrating it is to experience website delays or crashes. It can be annoying and frequently costs e-commerce businesses money whenever the slightest performance issue occurs. Performance problems can, in a nutshell, be very disappointing and costly. As a result, teams need to frequently invest time and effort in performance testing. Performance testing ensures that the application is as fast, responsive, stable, and reliable as needed. Additionally, it increases user confidence in the program in question, which leads to better execution and requires less upkeep.

One may encounter redundant tests that need to be run frequently or at set intervals. To avoid manual effort in this regard, CI/CD tools step in to ensure scheduled runs for the builds and have a report of the run ready whenever it is desired. Typically, every project team uses a Continuous Integration tool. Running your tests in CI is important as it helps catch bugs and ensures that changes to the code do not affect the existing features by running automated tests to reduce manual effort. Therefore, test engineers must be familiar with the basics of any CI/CD tool.

This blog will cover a few ways performance tests can be run with JMeter using Jenkins.

As a prerequisite, you must be familiar with the basics of setting up JMeter and Jenkins.

The first step is to start Jenkins. On Mac, you can execute the following command on your terminal to do so:

brew services restart jenkins-lts

This will launch Jenkins on the port specified during setup.

Go to Manage Plugins and download the Performance Plugin.

Then, go to the Jenkins Dashboard and then create a freestyle job.

Now, whether you are running locally or cloning the project with Git, you must save the path to your JMX and properties files correctly along with an empty results file having .jtl format. The only change in both cases will be the directory structure.

Next, go to Configure > Build Steps > Here, enter the directory and specify the shell command to run your performance tests and specify the earlier mentioned paths. Some parameters in the command may contain the following:

  • -n to denote non-GUI mode
  • -t followed by the location for the JMeter test script
  • -l followed by the location of the result file

Next, either configure a performance test report on Jenkins or use JMeter’s own. For the Jenkins report, set the following in the Publish Performance test result report section.

Once you have run the tests, you will see your results here under Performance Trends.

Similarly, if you wish to generate a JMeter report instead of using the default Jenkins one, you can update the command in the Build section like so, deleting any previously existing reports to generate new ones. The following additional parameters need to be added:

  • -e To generate HTML Reports
  • -o followed by the location of the Output folder to store the report

Likewise, if you wish to email the report to your team, you can do so by using Post-build Actions and specifying the path to the report file as part of the attachments.

--

--