【问题标题】:When I use Jmeter 5.0 and Jmeter Maven Plugin 2.7 together, it doesn't generate JTL file by default当我同时使用 Jmeter 5.0 和 Jmeter Maven Plugin 2.7 时,它默认不生成 JTL 文件
【发布时间】:2018-10-04 03:22:48
【问题描述】:

我的 Jmeter 测试计划有两个线程。每个线程使用不同的 CSV 文件,运行单独的测试。

我希望它在执行结束时生成两个 JTL 文件。为了实现这一点,我按照此处Jmeter: Test plan has two thread groups but it generated only 1 jtl report 的建议为每个线程添加了单独的Aggregate Table 侦听器。它仍然没有生成 JTL 文件。所以我将 Jmeter 从 3.2 升级到 5.0,将 Jmeter Maven 插件从 2.1.0 升级到 2.7.0。现在它正在生成两个单独的 CSV 文件,而不是 JTL 文件。

我做错了什么?还是插件的限制,它不会生成 JTL 文件?

我正在使用 Maven 3、Windows 7、Java

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.7.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>
                    <configuration>
                        <resultsFileFormat>xml</resultsFileFormat>
                        <generateReports>false</generateReports>
                    </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>

【问题讨论】:

  • 尝试使用支持 JMeter 5 的最新版本 2.8.0

标签: jmeter maven-3 jmeter-maven-plugin


【解决方案1】:

根据 JMeter Maven 插件release notes

这个插件的当前版本是 2.7.0,它需要 JDK 8 并且使用 Apache JMeter 4.0

所以我认为您不能真正将 JMeter 5.0 与当前版本的 JMeter Maven 插件一起使用。

以下是故障排除步骤:

  1. 下载JMeter 4.0from JMeter Archives page 并确保您的测试运行良好。如果有任何问题,即您的测试使用了不再存在的已弃用功能,或者您遇到了不兼容的更改 - 请相应地修复您的测试。一旦你可以在 GUI 模式下运行测试 - 你应该能够使用 Maven 运行它
  2. 查看target/logs 文件的内容,它应该包含每个.jmx 脚本的日志文件,该文件位于src/test/jmeter 文件夹中,在绝大多数情况下,JMeter 日志文件包含足够的信息以便能够找出问题的根本原因。

  3. 如果您无法自己找出原因 - 下次请务必更新您的问题:

    • 测试计划截图
    • mvn verify 命令的输出
    • JMeter 日志文件内容

【讨论】:

    【解决方案2】:

    如果你想让它生成 JTL (=XML) 文件添加到 maven 插件这个:

                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>2.7.0</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <resultsFileFormat>xml</resultsFileFormat>
                        <generateReports>false</generateReports>
                    </configuration>
                </plugin>
    

    见:

    在您显示的配置中,您在将其添加到 jmeter-graph-maven-plugin 插件时犯了一个错误

    【讨论】:

    • 您确定格式正确吗?这应该添加到 pom.xml 中吗?哦,你修复了格式。让我快速测试
    • 它不起作用,它仍在结果目录中生成 csv 文件。我已经补充了,也许我做错了什么
    • 描述中的那个是更新的那个。使用您提供的配置设置进行了更新。
    • 你需要把它放在 jmeter-maven-plugin 而不是其他插件中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多