Jmeter:测试计划有两个线程组,但它只生成了 1 个 jtl 报告 [英] Jmeter: Test plan has two thread groups but it generated only 1 jtl report

查看:40
本文介绍了Jmeter:测试计划有两个线程组,但它只生成了 1 个 jtl 报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 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:

可以我们在 Jmeter 的单个测试计划中并行运行两个线程组?

为什么只有 2 个出 3 个 JMeter 线程组执行?

我使用的是 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:

  1. src/test/jmeter 文件夹下有 2 个 .jmx 脚本
  2. 您启用 Aggregate Report 侦听器并将它们配置为将结果保存到 ../results 文件夹以测试名称或 __threadGroupName() 为前缀(该功能自 JMeter 5.0 起可用)
  1. You have 2 .jmx scripts under src/test/jmeter folder
  2. 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 文件,如果 JMeter 测试通过 Maven 插件执行,日志文件是(是) 位于 target/jmeter/logs 文件夹下,相对于您的主 pom.xml 文件.通常,它应该包含足够的故障排除信息以找出问题的根源.未执行 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆