Integrate Apache JMeter with Jenkins

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.

Prerequisites

  • 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.

Integrate Apache JMeter with Jenkins - FreeStyle Project
Integrate Apache JMeter with Jenkins – FreeStyle Project
  • 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.

Integrate Apache JMeter with Jenkins - General Settings
Integrate Apache JMeter with Jenkins – General Settings

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.

Integrate Apache JMeter with Jenkins - Build Triggers
Integrate Apache JMeter with Jenkins – Build Triggers

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

Integrate Apache JMeter with Jenkins - Build Details
Integrate Apache JMeter with Jenkins – Build Details

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.

Integrate Apache JMeter with Jenkins - Post Build Actions
Integrate Apache JMeter with Jenkins – Post Build Actions

If your system is ON, Jenkins will trigger the job when the time arrives. You can check all the build status in the homepage.

Integrate Apache JMeter with Jenkins - Build History
Integrate Apache JMeter with Jenkins – Build History

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.

About the Author

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link