简体   繁体   English

如何从本地maven项目运行jmeter方案(.jmx文件)?

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

I have created maven project repositories on my local machine successfully. 我已成功在本地计算机上创建了maven项目存储库。 (ref: https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki ) (参考: https//github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki

Also, I wrote test scenario in JMeter which works fine. 另外,我在JMeter中编写了测试场景,工作正常。

As per the documents available on internet, I kept my .jmx file in "\\src\\test\\jmeter" directory. 根据互联网上提供的文件,我将.jmx文件保存在“\\ src \\ test \\ jmeter”目录中。

My POM.xml looks like: 我的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.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. 在运行“mvn verify”命令时,不执行.jmx文件。 but "Build Successful" message is displayed. 但会显示“Build Successful”消息。

What am I missing in pom.xml file? 我在pom.xml文件中缺少什么? What should I do to trigger .jmx file located in "\\src\\test\\jmeter" directory? 我该怎么做才能触发位于“\\ src \\ test \\ jmeter”目录下的.jmx文件?

Try to remove the <pluginManagement> element from your example. 尝试从示例中删除<pluginManagement>元素。 pluginManagement is only a way to share the same plugin configuration across all your project modules. pluginManagement只是一种在所有项目模块中共享相同插件配置的方法。 See this question about pluginManagement for details. 有关详细信息,请参阅有关pluginManagement的此问题

Tests should be stored in: 测试应存储在:

${project.basedir)/src/test/jmeter $ {project.basedir)/ src目录/测试/ JMeter的

are you trying to store them in a root folder on your hard drive? 你试图将它们存储在硬盘上的根文件夹中吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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