Integrate Apache JMeter with Jenkins In my last article, you have learnt how to use JMeter to download free eBooks from PacktPub. Please check out my GitHub before you proceed further. In this article, we shall see about how to integrate Apache JMeter with Jenkins.
- Last article information
- Latest version of Jenkins
What is Jenkins?
Jenkins is a very famous open source automation server written in Java by Kohsuke Kawaguchi. It was forked from Hudson project after dispute with Oracle. Please go through wikipedia page of Jenkins to know more about the history of Jenkins. Right now, the stable release is 2.32.3. I suggest you to download that to integrate Apache JMeter with Jenkins.
Freestyle Project in Jenkins
To integrate free eBook download script with Jenkins, you need to create a freestyle project in Jenkins. We shall see how to create freestyle project in Jenkins.
After successful installation, please make sure that you have admin access to Jenkins portal. By default, the port is 8080.
- Login into http://localhost:8080/
- Click on New Item
- Enter an item name as shown below
- Click on Freestyle project
- Click on OK.
In the next screen, enter project name and description as shown below. Do not check any other checkboxes, unless you are sure what you are doing.
In Build Triggers section, enter “00 20 * * 1-5” which means every weekday at 8.00 PM local time, your job will be triggered. Please see below screenshot.
Next step is to invoke JMeter script by adding build step using Execute Windows batch command and enter below command.
C:\TestingTools\apache-jmeter-3.1\apache-jmeter-3.1\bin\jmeter.bat -Jjmeter.save.saveservice.output_format=xml -n -t C:\TestingTools\apache-jmeter-3.1\apache-jmeter-3.1\bin\QAInsights\DownloadBookFromPacktPub\PacktPubDownload.jmx -l MyLog.jtl
Above command will invoke JMeter and run the script without calling the actual GUI. All the logs will be stored in MyLog.jtl.
In case if you want to trigger email if anything goes wrong, you can add Post-build Actions as E-mail Notification shown below. Hit Save.
If your system is ON, Jenkins will trigger the job when the time arrives. You can check all the build status in the homepage.
Here is the video tutorial about integrate Apache JMeter with Jenkins.
Your turn: Have you tried my GitHub script and integrated with Jenkins. If you face any issues, please do let me know in the comments section.