我在我的项目中添加了Jmeter插件,现在它的负载测试与maven构建一起运行。
<!-- Jmeter -->
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>deploy</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>我希望只通过运行以下命令就可以运行J抄测试:
mvn jmeter:jmeter -Pjmeter我不希望它在执行任何maven生命周期时运行,例如:
mvn install当测试在Restful中执行时,负载测试将在每次运行maven生命周期时在数据库中执行POST和创建数据。
有人能帮我吗?
发布于 2020-01-27 09:37:14
只需将JMeter Maven插件声明放在配置文件下面,如下所示:
<profiles>
<profile>
<id>jmeter</id>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>这样,只有在显式指定JMeter配置文件时,才会执行jmeter maven插件。
演示:

更多信息:
https://stackoverflow.com/questions/59888408
复制相似问题