To integrate JMeter with Jenkins, run your JMX file in command line (non-GUI) mode from a Jenkins build step, write the results to a JTL file, and publish them with the Performance plugin, which builds a performance trend and can mark the build unstable or failed when a threshold is crossed. The same pattern works in GitLab CI with a script: step. If you would rather not keep JMeter on a build agent at all, you can call PFLB Platform from the pipeline instead: the job starts a test over the REST API, waits for the result, and branches on the SLA verdict. This guide is for QA and DevOps engineers who want a performance test to run on every build without a person clicking Start. It covers the standard JMeter route first, then the PFLB route with the steps and scripts from the PFLB documentation. We checked the facts on 13 November 2026 against the Jenkins, Apache JMeter and Taurus documentation and the PFLB Platform documentation, and link the sources.
Why Integrate Apache JMeter with Jenkins?
Jenkins is an open source automation server, and continuous integration is what it is used for most: every commit to the git repository starts a build. A performance test that lives outside that flow is run when someone remembers. The Jenkins documentation lists the benefits of putting JMeter tests into the pipeline: unattended test execution, build failure logs, easy access to test reports of each build, and automation of routine work (Using JMeter with Jenkins). For load testing the point is simpler: a regression in response time or error rate shows up on the build that caused it, not many builds later. The results give the usual KPIs of a performance test: response time, throughput and error rate.
How to Integrate JMeter with Jenkins: The Standard Setup
The common setup has four steps, and two alternatives are described after them. It starts from one rule in the JMeter manual: build the test plan in the GUI, but run the load in command line mode, because GUI mode is not meant for load testing (Apache JMeter, Getting Started).
- Install JMeter where the build runs. The JMeter installation and Java must be on the machine that executes the job, whether that is a Jenkins server or an agent. Download the
.zipfor Windows or the.tgzfor Linux, extract it, and put itsbinfolder on the path of that machine. The Jenkins page runs it on the controller for the sake of the tutorial, and says that in a production environment JMeter should run on a Jenkins agent, not on the controller (Using JMeter with Jenkins). - Keep the JMX file in version control. Commit the JMX file to the same git repository as the code, or to a repository next to it, so a build always runs the test plan that matches the source code. Jenkins pulls the script from the repository, so the pipeline starts with a checkout stage. Keep the CSV data files that the test plan reads next to the JMX file.
- Run JMeter tests from a build step. On the Jenkins dashboard select New Item, name the job, select Freestyle project and click OK. In the job configuration add an "Execute shell" build step to execute JMeter (on Windows, "Execute Windows batch command"), then save. In a Jenkins pipeline, call the same command from an
shstep:jmeter -n -t tests/checkout.jmx -l results.jtlThe
-noption starts JMeter in command line mode,-tpoints to the test plan, and-lnames the JTL file where sample results are logged. Add-e -o reportto generate the HTML dashboard after the run; the output folder must not exist or must be empty (Apache JMeter, Getting Started). To parameterize the run, pass properties with-J, for example-Jusers=50, and read them in the test plan with the__Pfunction, for example${__P(users,10)}. In a parameterized Jenkins pipeline, the build parameters feed these options. - Publish the results with the Performance plugin. Install it in Manage Jenkins, then Plugins. In a freestyle project add "Publish Performance test result report" under post build actions, list the files in the "Source data files" field (globs such as
**/*.jtlwork), and set the thresholds that make a build unstable or failed: error percentage, average response time, or the change against the previous build. Expert mode adds constraints on average, median, 90th and 95th percentile and error percentage, absolute or relative (plugin source). In a pipeline the shorthand isperfReport:pipeline { agent any stages { stage('Checkout') { steps { checkout scm } } stage('Load test') { steps { sh 'jmeter -n -t tests/checkout.jmx -l results.jtl' } } } post { always { perfReport 'results.jtl' } } }The plugin reads JMeter CSV and XML results, detects the format of each file, and adds a Performance Trend page with a chart for every build, and every build gets its own Performance report page with the details of its test run (Performance plugin, reporting). Build triggers decide when it runs: a commit (a webhook from your git server or polling of the repository), a schedule with Build periodically, or another job. The Jenkins tutorial also sets
jmeter.save.saveservice.output_format=xmlinuser.propertiesso that JMeter writes XML for the plugin.
Two other routes. The Performance plugin can run the test for you through Taurus, a wrapper that runs JMeter and other tools from a YAML config and sets the build status from its exit code (Performance plugin, running tests, Taurus). The JMeter Maven plugin runs the tests from src/test/jmeter with mvn clean verify, which suits Java projects that already build with Maven (jmeter-maven-plugin).
GitLab CI and other runners. The idea is the same, only the file changes. In .gitlab-ci.yml a job with an image that has JMeter runs the same jmeter -n command in its script: section and keeps results.jtl and the HTML report as artifacts. See the GitLab CI/CD documentation for the syntax (GitLab CI/CD).
Where Running JMeter Tests in Jenkins Gets Hard
This setup works well for a smoke test on every commit: a small number of users for a few minutes. It gets harder when the test grows:
- The load comes from your build agent. A Jenkins agent is sized for builds, and a test with many virtual users competes for its CPU, memory and network. For more load you need more machines and the master/slave setup of JMeter on top of Jenkins.
- You keep the plumbing. Java and JMeter versions, Jenkins plugins, the
user.propertiesfile, agents and data files for every test are yours to maintain. - The pass or fail rules live in each job. The plugin can judge a build on error rate, average response time or, in expert mode, percentiles. But the rule is configured in every Jenkins job that needs it, and the verdict is a Jenkins build status. A requirement like "95% of checkout calls under 800 ms" has to be written as a constraint, job by job.
- Reports live in Jenkins. The trend is there, but sharing a run with someone who has no Jenkins access takes extra work.
Run a PFLB Load Test from Jenkins and GitLab CI
PFLB Platform takes a different route. The load test is configured and run on the platform, and the Jenkins job only sends HTTP requests: one to start the test, one to read the SLA verdict. The documented route is the platform's REST API, called from Jenkins with two plugins you may already have, HTTP Request and Generic Webhook Trigger (PFLB docs, Jenkins). The setup, as the documentation describes it:
- Prepare the test in PFLB Platform. Create the test, configure its SLA, and create a settings set. In the settings set, open the Webhooks tab, click + Add new webhook, select the Finished and Canceled test statuses, and enter
JENKINS_URL/generic-webhook-trigger/invokeas the URL with atokenkey and your Jenkins token as the value. - Create a Jenkins pipeline that starts the test. It is parameterized with the API token (
secret_api_key), the test ID and the test version ID. The script sends a POST request tohttps://platform.pflb.us/public-api/v1/testRun:def patchOrg = """ {"testId": ${test_id}, "testVersionId": ${test_version_id}} """ def response = httpRequest( url: "https://platform.pflb.us/public-api/v1/testRun", customHeaders: [[name: 'api-token', value: "${secret_api_key}"]], requestBody: patchOrg, httpMode: 'POST', contentType: 'APPLICATION_JSON' ) - Create a second pipeline for the webhook. When the test finishes, the platform sends a webhook to Jenkins. In the build triggers of this pipeline, select Generic Webhook Trigger, take the test run ID from the post content with the JSONPath expression
$.idinto a variable calledtestRunId, and set the same token. The pipeline then asks the platform for the SLA of that test run withGET https://platform.pflb.us/public-api/v1/testRun/sla?testRunId=...and readsslaResults.statusfrom the response. - Branch the build on the SLA. In the documentation example, a status of
SUCCESSstarts aGreen_Jobpipeline andFAILUREstarts aRed_Jobpipeline. The docs suggest what to put there: if the results are not satisfactory, the code goes back for revision, and if testing was successful, the app is deployed to production. - Run it. Open the Jenkins project, click Build with parameters and fill in the API token, test ID and version ID. To run the test on a schedule, enable Build periodically in the build triggers and enter a cron expression, for example
0 22 * * 1-5for every working day at 22:00. When the test run is complete, the SLA verdict appears in the Console Output of the build. To start it on a commit, use the Jenkins instructions for your stack.
GitLab CI. The documentation provides a ready .gitlab-ci.yml that you download and put in the root of your repository (PFLB docs, GitLab CI). You set the API token, the test ID and, optionally, the test version ID. If you leave the version empty, the latest version of the test runs. The script in the file sends the request that runs the test, gets the test run ID from the response, then checks the SLA status every 30 seconds. While the status is PROCESSING it keeps waiting; when it is FINISHED, it reads the SLA result. The loop that does the polling looks like this in the file:
while [ "$SLA_PROCESSING_STATUS" = "PROCESSING" ] ; do
sleep 30
SLA_RESPONSE=$(curl ... -H "api-token: $API_TOKEN" ...)
SLA_PROCESSING_STATUS="$(echo $SLA_RESPONSE | jq -r .testResultSlaState)"
done
The result goes into SLA_RESULT_STATUS, which the load_test job passes to the next stage as a dotenv artifact, so the deploy stage can decide what to do. Take the current file from the documentation page rather than copying this excerpt: it is shortened here to show the logic.
If a job fails with a 404 error, the documentation says to check that the variables in the file are set correctly.
A PFLB test does not have to start in a JMeter script. You can build the test by importing a JMX file (import from JMX), by importing requests from a HAR file, Postman or Insomnia, or by creating the requests in the platform. What the pipeline needs is the ID of the test and its API token.
JMeter in Jenkins or a PFLB Test in the Pipeline
| JMeter in Jenkins | PFLB Platform from Jenkins or GitLab CI | |
|---|---|---|
| What the job does | Runs JMeter on the build agent and publishes the JTL file | Sends an API request, receives the SLA verdict |
| What you maintain | Java, JMeter, plugins, agents, data files | The pipeline script and the API token |
| Pass or fail rule | Thresholds and constraints set in each Jenkins job (error rate, response time) | The SLA configured for the test in the platform |
| Good for | Quick smoke tests on every commit | Larger tests and a gate before release |
The two are not exclusive. You can keep a small JMeter smoke test in the commit build and call the platform for the larger run before a release.
If you want help turning this into a release gate, PFLB's performance engineers design the load model, write the scripts and wire the tests into your CI.