0

我正在使用带有 Maven 插件的 Jmeter 并在执行后生成相同的 html 报告,在 src/test/jmeter 文件夹中添加了 .jmx 文件,并将 csv 保存在不同的文件中以读取参数。

这就是我的 pom.xml 在构建时的样子。

<build>
    <plugins>
        <plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>3.4.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>
            <configuration>
                <propertiesUser>
                    <csvPath>${basedir}/src/test/resources/testData.csv</csvPath>
                </propertiesUser>
                <generateReports>true</generateReports>
            </configuration>
        </plugin>
    </plugins>
</build>

我正确获取了 result.csv,但 html 报告显示了当天第一次随机执行的数据。

如果我在这里遗漏了什么,请告诉我。

提前致谢!!!

4

1 回答 1

0
  1. 默认情况下,报告是在target/jmeter/reports/your_test_name/文件夹下生成的

  2. 如果“旧”报告存在 - 您将收到以下错误消息:

    An error occurred: Cannot write to 'target/jmeter/reports/your_test_name' as folder is not empty
    

因此,请仔细检查您在浏览器中打开的路径,以防万一确保调用cleantask,而不是:

maven verify

称呼

maven clean verify

您还可以始终从 .csv 结果文件生成 HTML 仪表板,如下所示:

jmeter -g /path/to/CSV/file -o /path/to/dashboard/folder

最后但并非最不重要的一点是,您是否尝试过在浏览器中刷新仪表板页面?

更多信息:如何使用 JMeter Maven 插件

于 2021-08-05T12:35:44.507 回答