简体   繁体   中英

how to run jmeter scenario (.jmx file) from local maven project?

I have created maven project repositories on my local machine successfully. (ref: https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki )

Also, I wrote test scenario in JMeter which works fine.

As per the documents available on internet, I kept my .jmx file in "\\src\\test\\jmeter" directory.

My POM.xml looks like:

<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.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-app</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>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.9.0</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</project>

On running "mvn verify" command , no .jmx file is executed. but "Build Successful" message is displayed.

What am I missing in pom.xml file? What should I do to trigger .jmx file located in "\\src\\test\\jmeter" directory?

Try to remove the <pluginManagement> element from your example. pluginManagement is only a way to share the same plugin configuration across all your project modules. See this question about pluginManagement for details.

Tests should be stored in:

${project.basedir)/src/test/jmeter

are you trying to store them in a root folder on your hard drive?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM