Maven is more of a Project management tool, which follows a standard project structure to ease the development process. Moreover, it takes care of setting up JMeter with all the dependencies to run the test.

How to create a maven project and pom.xml file?

  1. Create a folder structure as below.

JMeterWsdlProject

——Src

———-Test

————–JMeter

—————– Demo-Test.jmx

——pom.xml

  • JMeterWsdlProject: This is JMeter project name and you can provide any name
  • Src: This is the source folder, it should be of the same name
  • Test: It should be of the same name
  • JMeter: You can change this folder name
  • Demo-Test.jmx: This is a JMeter test script project
  • XML: This is maven file, it should be at the root folder. Pom.xml file contains below code:

<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>jmeter-maven-test</groupId>

  <artifactId>jmeter-maven-test</artifactId>

  <packaging>jar</packaging>

  <version>1.0-SNAPSHOT</version>

  <name>jmeter-maven-test</name>

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

How to execute a JMeter test using maven?

  1. Open command prompt
  2. Go to the root of the project of maven JMeter
  3. Run below command

mvn installHow to Execute a JMeter Test Using Maven

  1. You should see below screen where mvn starts downloading all required dependencies and then executes the testHow to Execute a JMeter Test Using Maven
  2. After executing you should see the report under “target\jmeter\report”

How to Execute a JMeter Test Using Maven

  1. Open HTML file you should see a report like below:

How to Execute a JMeter Test Using Maven

You may also like: How to Setup Maven on Windows?

 

Leave a comment

Your email address will not be published. Required fields are marked *