Sync JMeter Samplers With Jenkins Job
Once JMeter and Jenkins integrated, we may notice Jenkins job get passed even though Jmeter samplers fail. This happens because Jenkins job does not check whether Jmeter samplers are passed or failed, however Jenkins job checks only the Job build commands executed or not. Jenkins job never bothers whether samplers are executed or not until we do not configure Jenkins job.
The question is, how to do the setup so that if any sampler fails in Jmeter then Jenkins job should get failed.
We can do the setup by using Performance Plugin which will pick the data from Jmeter test result and will make the Jenkins job pass or fail.
Performance plugin also provides graphical test execution report at Jenkins dashboard.
Follow the below steps to do the setup and sync JMeter test results with Jenkins Job.
Make sure you are saving Jmeter test result in csv file and Jenkins is running successfully. If you are not sure how to run Jenkins and generate Jmeter test report, please follow the link- Integrate Jmeter With Jenkins and Generate HTML Report
Install Performance Plugin in Jenkins
Follow below steps to do the setup-
- Go to Jenkins home page and click on Manage Jenkins.
- Scroll down and then click on Manage Plugins.
- Search for performance plugin and install it. Restart Jenkins.
Configure Performance Plugin in Jenkins.
- Go to the build created and click on Configure shown on left side.
- Click on Post Build Action and select Publish Performance test result report from drop down.
- Change the values same as shown below. Provide the csv path where you are saving Jmeter test result.
- Click on Apply and Save button.
Run Jenkins Job and Verify Test result
- Execute the Jenkins build to confirm setup is working fine. On successful execution you will see the test result on Jenkins project page.
To make sure Jenkins build is synced successfully please change the Jmeter script so that Jmeter script should fail. Once Jmeter script fails the same should reflect in Jenkins Job and Jenkins Job should get failed.