Jmeter-Jenkin-Integration-Test is a sample project to show how the jmeter test are integrated in Jenkins CI pipeline. It provides step by step to run in jenkins and also shows how to generate performance reports.
JMeter is an open source testing software. It is 100% pure java application for load and performance testing. JMeter is designed to analyse and measure the performance and load functional behaviour of web application and variety of services.
JMeter is mainly used for testing Web application or FTP application but currently, it is applicable in functional testing, JDBC database connections, Web services, generic TCP connections and OS native processes. jMeter is designed to cover categories of tests like load, functional, performance, regression, etc., and it requires JDK 5 or higher.
Following are some important features of JMeter:
- Open source application: JMeter is an open source software. Therefore, it is freely available.
- User-friendly GUI: It has a simple and interactive GUI.
- Support various server types: JMeter can conduct load and performance test for many different server types – Web – HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail – POP3, etc.
- Platform independent: It is a platform independent tool as it is written and developed using Java.
- Framework: It is a multi-threading framework which allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
- It is highly extensible.
- You should have Jmeter installed on your PC. You can install using the following link. Jmeter installation steps
- You should have Jenkins installed on your PC. for installation follow this steps. Jenkins installation steps
- Clone the project in your PC using git clone cmd. Or download the Zip file.
git clone https://github.com/Anilkumar-Shrestha/Jmeter-Jenkin-Integration-Test.git
- Configure and add Performance plugins in Jenkins
- Create a freestyle project and configure it.
-
Give a suitable project name and select the free style project and click on OK button as shown.
-
Go to Build and click on Add build steps. It pop up the list where you should click on "Execute Window batch Command".
-
Add below command lines. (You can check this doc for command line parameters).
- C:\apache-jmeter-5.3\bin\jmeter : Jmeter.exe path
- -Jjmeter.save.saveservice.output_format=xml : for output to save in xml. if you want to save in csv, you can change it.
- -n : for running in non gui mode
- -t C:\apache-jmeter-5.3\Jmeter-jenkin-integration-test\Jmeter-Jenkin-Integration-Test\jmeter_jenkin_test.jmx : for your jmx script test file location.
- -l jmeter-jenkin-testresult.jtl : Location and filename for output result file to save
C:\apache-jmeter-5.3\bin\jmeter -Jjmeter.save.saveservice.output_format=xml -n -t C:\apache-jmeter-5.3\Jmeter-jenkin-integration-test\Jmeter-Jenkin-Integration-Test\jmeter_jenkin_test.jmx -l jmeter-jenkin-testresult.jtl
- Click on Build Now. You should build twice or more to see the graphical performance report.
- Go to build number and check the Performance Report. You will see the report as follows.
- Also you will see the Performance trend in the project dashboard.
5. Steps to add jmeter-metrics dashboard report
- Firstly to add jmeter-metrics, we need to install it. Go to command line and enter below command.
pip install jmeter-metrics
Note: For jmeter-metrics to work we should first save the output log file to csv format. i.e we should use -j params as:
-Jjmeter.save.saveservice.output_format=csv
-
Add below command lines. (You can check this doc for command line parameters).
- C:\apache-jmeter-5.3\bin\jmeter : Jmeter.exe path
- -Jjmeter.save.saveservice.output_format=csv : for output to save in csv format.
- -n : for running in non gui mode
- -t C:\apache-jmeter-5.3\Jmeter-jenkin-integration-test\Jmeter-Jenkin-Integration-Test\jmeter_jenkin_test.jmx : for your jmx script test file location.
- -l jmeter-jenkin-testresult.jtl : Location and filename for output result file to save
C:\apache-jmeter-5.3\bin\jmeter -Jjmeter.save.saveservice.output_format=csv -n -t C:\apache-jmeter-5.3\Jmeter-jenkin-integration-test\Jmeter-Jenkin-Integration-Test\jmeter_jenkin_test.jmx -l jmeter-jenkin-testresult.jtl
jmetermetrics --input ./ --output jmeter-jenkin-testresult.jtl -M jmeterMetricsReport.html
- jmetermetrics : command to run jmeter metrics
- --input ./ : Path of result files
- --output jmeter-jenkin-testresult.jtl : Name of *.jtl or *.csv result file
- -M jmeterMetricsReport.html : Output name of the generate metrics report
- click on build Now.
- Go to the project and click "Workspace". You can see the metrics report html file. Click the file and open in your favourite browser.
- You can change the logo as well with --logo parameter send.
If you face error "javascript not enable" while viewing the html file in chrome, you can troubleshoot with the steps mentioned here
The Throughput is the most important parameter in stress testing. It signifies number of transactions or requests that can be made in a given period of time. It is a useful measurement to check the load capacity of the server. It represents the ability of the server to handle a heavy load. The higher the Throughput is, the better is the server performance.
If you have any questions / suggestions / comments on the report, please feel free to reach me at
- Email:
[email protected]
- LinkedIn:
Anil Kumar Shrestha
⭐ repo if you like it