0% found this document useful (0 votes)
175 views5 pages

Jmeter Integration With Jenkins and Maven Notes

Install Maven, create a simple Maven project with the JMeter plugin, add a JMeter test file, run the test with Maven, commit the project to GitHub, set up Jenkins with necessary plugins, configure Jenkins with file paths and the GitHub project, and create a Jenkins job that runs Maven to execute JMeter tests and archives the results reports.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views5 pages

Jmeter Integration With Jenkins and Maven Notes

Install Maven, create a simple Maven project with the JMeter plugin, add a JMeter test file, run the test with Maven, commit the project to GitHub, set up Jenkins with necessary plugins, configure Jenkins with file paths and the GitHub project, and create a Jenkins job that runs Maven to execute JMeter tests and archives the results reports.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1) Install Maven

Download Maven and set the path in environmental variables and verify with

mvn --version
2) Create a simple maven project
Use the quick start archetype:

mvn archetype:generate -DgroupId=com.example -DartifactId=projectname -


DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
3) Directory structure should be as follows
Main folder → src → test → jmeter → file.jmx
→ pom.xml
4) Add the Jmeter Maven Plugin
Edit the pom.xml. Remove the junit dependency and add jmeter plugin. It should
look like this:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jmeter-demo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-demo</name>
<url>http://maven.apache.org</url>

<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
5) Create a Jmeter Test and place the jmx file inside jmeter folder
6) Run it in Maven
Go to the project path and run the below command:

mvn install
7) Commit the Maven project to github
Create a repository in your github
Go to directory from command prompt
Do the following
→ $ git init
→ $ git add .
→ $ git commit -m 'First-commit'
Copy the link from your repository
→ $ git remote add origin <remote-repo-link>
→ $ git remote -v
→ $ git push origin master
8) Get Jenkins Running
Running a Jenkins instance locally is very easy. Download the latest Jenkins war
and then run the below command.

java -jar jenkins.war


9) Add the Performance Plugins
Go to Manage Jenkins → Manage Plugins → Available and add the following
plugins:
→Maven Integration plugin
→Git plugin
→GitHub plugin
→Performance plugin

10) Add Paths in Jenkins


Go to Manage Jenkins → Configure System and add paths of JDK, Maven and Git in
Jenkins.
11) Create the job in Jenkins
→Go to the Jenkins main page.
→Click New Job.
→Give the job a name.
→Choose free-style software project.
→Click OK
→Select Git under source code management
→Set the repository URL to <remote-repo-link>
→Add a Maven build step with “verify” as the goal.
→Down in Post-build Actions check the Publish Performance test result report
checkbox.
→Click the Add a new report box and choose JMeter.
→For Report files specify **/*.jtl
→Also under Post-build Actions check the Archive the artifacts checkbox.
→Under Files to archive specify **/*jtl-report.html. This will keep a copy of the html
formatted reports for each build so you can look at them in Jenkins.
→Click Save
→Click Build Now

12) Verify the reports

You might also like