Why?
Created your JMeter scripts and wrote a lot of customized code…
- But still running the code using JMeter UI or command-line?
- A non-developer still needs your help to change workload model settings to execute different types of performance tests or customized test executions?
- Still using boring Excel to manually compare results between test runs or builds or releases?
- Frantically searching for the results of a particular past build or release, in every results directory?
Not anymore…..
Did you know that JMeter seamlessly integrates with Jenkins server, with a few tweaks here and there and in code and an open-source plugin, providing solution to the above scenarios
How?
We will use the Performance plugin.
- After you install and setup Jenkins server, install the performance plugin using Manage Jenkins-Plugins. Create a job related to your script(s).
- While configuring the job, in the Build Steps section, use parameter values to pass in the command-line. For e.g. The host, port, dbName, dbuser, user pwd etc. have been passed along with constant timer, random timer (if any), user count to easily change workload model settings during execution. Add the line -j jmeter.save.saveservice.output_format=xml to this command-line invocation so that performance results can be produced and trend graphs displayed. 
- Check ‘This project is parameterized’ and add the parameters (of course same name should be used) which you have passed in the Build Steps’ Execute shell section.
- Add Post-Build Action to the Build, select the ‘Publish Performance test result report’ and add the path to your result jtl file (which you provided in the Execute Shell Command in Build Steps. Check the ‘Show Trend Graphs’, if not checked already and choose your Error Threshold. You may use Advanced options to choose the metrics to display, percentiles to display and also fail the build if the result jtl file is not present.
- Now pass the parameters in your jmeter code. For JDBC Connection Configuration parameters, use the ${__P()} methods instead of regular parameters. Providing a jmx snippet below for better understanding:
What you get?
- You may run the job with the parameters now supplied during run-time itself from Jenkins UI which is intuitive, and any user may use it, without much scratching their heads
- Check the Performance Report once the result is parsed and created by Performance Plugin. A sample result looks like this:
- You also have the option to view Trend Results at one glance and therefore comparative analysis is already taken care of: no more writing formulas in excel.
- You can also filter the trend results according to your needs, for e.g. view the trend for the last n builds or of a particular build, without searching here and there:
-- Nabanish Sinha(https://w3.ibm.com/#/people/0051RK744)https://w3.ibm.com/#/people/0051RK744
Performance Solutions Architect, Guardium Security, System Test