Java 使用maven运行Jmeter测试
我正在学习jmeter并试图用Maven对其进行配置,但在运行“mvn verify-e”时遇到以下异常 我的pom.xml文件Java 使用maven运行Jmeter测试,java,maven,jmeter,jmeter-maven-plugin,Java,Maven,Jmeter,Jmeter Maven Plugin,我正在学习jmeter并试图用Maven对其进行配置,但在运行“mvn verify-e”时遇到以下异常 我的pom.xml文件 <build> <plugins> <plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-maven-plugin</artif
<build>
<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>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>analyze</goal>
</goals>
<configuration>
<source>${project.build.directory}/**/*.jtl</source>
<targetDirectory>${project.build.directory}/results</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
执行
mvn-e-X verify
,查看更多的输出、什么进展顺利以及错误发生的地点、时间和原因
将这些选项添加到jmeter maven插件中
,然后再次运行jmeter脚本。希望更多的细节能被展示出来,关于什么时候出了问题。目前看起来输出文件没有写入,所以
<configuration>
<!-- By default the test results are saved in a file /target/jmeter/results/<testname>-<timestamp>.jtl
Further processing is easier without timestamp though. -->
<testResultsTimestamp>false</testResultsTimestamp>
<!-- To simplify debugging, it is advisable to adapt the loglevel. The
jmeter logs are written to the file jmeter.log. -->
<overrideRootLogLevel>DEBUG</overrideRootLogLevel>
<!-- By default, the console output during a jmeter test run is suppressed.
We want to display the progress using the listener "Generate Summary Results"
(which periodically prints stats to stdout). Therefore we have to make sure,
that the jmeter output is not suppressed. -->
<suppressJMeterOutput>false</suppressJMeterOutput>
<!-- If tests fail (e.g. a http-request running into a timeout), the corresponding
maven goal also fails (and subsequent goals aren't executed anymore). We
want to create graphs from test-results, no matter if some requests failed
or not, so we ignore jmeter failures. -->
<ignoreResultFailures>true</ignoreResultFailures>
</configuration>
假的
调试
假的
真的
提示:使用最新版本(当前版本为1.10.1)是否存在以下路径C:\hass git\cpp\u ocp2\cpp\u ocp2\qa\jmeter\target\jmeter\results?也许,您只需要一个cpp_ocp2?你看到了吗?是的vincent,这条路径存在cpp_ocp2的两个文件夹。我已将配置更改为您发送给我的链接,但仍然收到相同的错误,您的
pom.xml
位于哪个目录?通常我希望它位于qa/jmeter
目录中。提示注释jmeter分析maven插件,查看它是否在不生成报告的情况下运行。如果是,请检查指定的目录是否包含预期的文件。(${project.build.directory}/***.jtl
)
qa/jmeter/src/test/jmeter/jmeterTests.jmx
<configuration>
<!-- By default the test results are saved in a file /target/jmeter/results/<testname>-<timestamp>.jtl
Further processing is easier without timestamp though. -->
<testResultsTimestamp>false</testResultsTimestamp>
<!-- To simplify debugging, it is advisable to adapt the loglevel. The
jmeter logs are written to the file jmeter.log. -->
<overrideRootLogLevel>DEBUG</overrideRootLogLevel>
<!-- By default, the console output during a jmeter test run is suppressed.
We want to display the progress using the listener "Generate Summary Results"
(which periodically prints stats to stdout). Therefore we have to make sure,
that the jmeter output is not suppressed. -->
<suppressJMeterOutput>false</suppressJMeterOutput>
<!-- If tests fail (e.g. a http-request running into a timeout), the corresponding
maven goal also fails (and subsequent goals aren't executed anymore). We
want to create graphs from test-results, no matter if some requests failed
or not, so we ignore jmeter failures. -->
<ignoreResultFailures>true</ignoreResultFailures>
</configuration>