0

I have been trying to run one Jmeter script through MAVEN, I was able to do that using command "mvn verify" and able to see the reports also inside /target folder

However, I want to run the Jmeter Performance Test directly through the JAR which is created after running the "mvn verify" command.

Below is my POM.xml

<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-testproject</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>jmeter-testproject</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>2.1.0</version>
        <executions>
        <execution>
            <id>jmeter-tests</id>
            <goals>
            <goal>jmeter</goal>
            </goals>
        </execution>
        </executions>
    </plugin>   
    </plugins>
  </build>
</project>

A /target folder is being generated after running "mvn verify" and also jmeter-testproject-1.0-SNAPSHOT created.

However, if I want to run the package by directly executing the JAR, it's giving just "Hello World" as an output which is present in the main class. I want the Jmeter Performance Test also to execute after directly clicking the JAR. Please help.

enter image description here

Rohan
  • 1
  • 2

1 Answers1

1

You can't do this with the jmeter-maven-plugin.

The jmeter-maven-plugin is taking your test plan/configuration and then running a JMeter process for you.

It is not physically building a runnable jar with everything that you need inside it to be able to run performance tests.

Ardesco
  • 7,281
  • 26
  • 49