Jmeter:测试计划具有两个线程组,但仅生成了1个jtl报告 [英] Jmeter: Test plan has two thread groups but it generated only 1 jtl report
问题描述
我的Jmeter测试计划有两个线程.这两个线程都需要单独的CSV(csv参数化)文件.
My Jmeter Test Plan has two threads. Both threads requires separate CSV (csv parameterization) files.
在测试mvn verify
结束时,我希望生成两个.jtl
文件,但只能得到一个.似乎只有1个线程正在运行.当我在GUI中运行时,它可以正常运行,而无需maven.
At the end of test mvn verify
I expect two .jtl
files generated, but get only one. Seems only 1 thread is running. When I run in GUI then it works fine, without maven.
测试计划:
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.performancetesting</groupId>
<artifactId>demo-performance-testing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<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>
<plugin>
<groupId>de.codecentric</groupId>
<artifactId>jmeter-graph-maven-plugin</artifactId>
<version>0.1.0</version>
<configuration>
<inputFile>${project.build.directory}/jmeter/results/*.jtl</inputFile>
<graphs>
<graph>
<pluginType>ResponseTimesOverTime</pluginType>
<width>800</width>
<height>600</height>
<outputFile>${project.build.directory}/jmeter/results/BlazeDemoRequest.png</outputFile>
</graph>
</graphs>
</configuration>
</plugin>
</plugins>
</build>
</project>
我已经看过这些帖子,但是没有运气:
I have already gone through these posts but no luck:
Why only 2 out 3 JMeter Thread group execute?
我正在使用Windows 7,Maven 3,Jmeter Maven插件
I am using Windows 7, Maven 3, Jmeter Maven Plugin
推荐答案
仅在2种情况下,您将生成2个.jtl文件:
You will have 2 .jtl files generated only in 2 cases:
- 您在
src/test/jmeter
文件夹下有2个.jmx脚本 - 您启用汇总报告侦听器并将其配置为将结果保存到
../results
文件夹,以测试名称或 __threadGroupName()为前缀(该功能是自 JMeter 5.0 )
- You have 2 .jmx scripts under
src/test/jmeter
folder - You enable Aggregate Report listeners and configure them to save results to
../results
folder prefixed by the test name or __threadGroupName() (the function is available since JMeter 5.0)
通常,如果您的JMeter测试有任何意外行为,请习惯查看 jmeter.log 文件,如果通过Maven插件执行JMeter测试,则日志文件为)位于相对于主 pom.xml 文件的target/jmeter/logs
文件夹下.通常,它应包含足够的疑难解答信息以深入研究问题. JMeter测试或线程组未执行的最常见原因是:
In general in case of any unexpected behaviour of your JMeter test get used to look at jmeter.log file, in case of JMeter tests execution via Maven plugin the log file(s) is(are) located under target/jmeter/logs
folder relative to your main pom.xml file. Normally it should contain enough troubleshooting information to get to the bottom of the issue. The most common reason for JMeter test or thread groups not being executed are:
- 提供的线程数不正确(即参数化失败)
- 缺少依赖文件(即CSV文件不在预期的位置)
这篇关于Jmeter:测试计划具有两个线程组,但仅生成了1个jtl报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!