jmeter - Jmeter:在 Windows 中运行的测试计划在 Centos 中失败
问题描述
我有一个有两个线程的测试计划。
每个线程将两个 CSV 文件作为测试数据。
我已经提供了 CSV 路径,因为\testdata\csvtest1.csv
这个目录位于src\test\jmeter\testdata
,当我运行这个计划时,它可以在 Windows 中通过 maven 在 GUI 模式和非 gui 模式下工作mvn clean verify
。
但是当我在 Centos 7 中运行它时,它给出了我在日志中发现的以下错误。
2018-10-04 13:56:24,739 INFO o.a.j.s.FileServer: Stored: \testdata\csvtest1.csv
2018-10-04 13:56:24,743 INFO o.a.j.s.FileServer: Stored: \testdata\csvtest2.csv
2018-10-04 13:56:24,740 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.IllegalArgumentException: File \testdata\csvtest2.csv must exist and be readable
因此,我在 Jmeter 的 bin 目录中手动复制粘贴了两个 CSV 文件的测试数据目录。尽管如此,它还是给出了同样的错误。
我也在这里尝试过解决方案jMeter java.lang.IllegalArgumentException: File example.csv must exist and be readable and commented on answer,但它没有用。
难道我做错了什么?
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>
<configuration>
<resultsFileFormat>xml</resultsFileFormat>
<generateReports>false</generateReports>
</configuration>
<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>
解决方案
尝试使用 /(斜杠)作为文件分隔符,并确保执行测试计划的用户可以读取文件。
推荐阅读
- ruby-on-rails - RSPEC 失败,不初始化工厂
- sql - 为其他列中的每个唯一值分配新值
- javascript - TypeError:无法在 React 组件中读取 null 的属性
- r - 删除组内顺序错误的行
- laravel - Laravel 5.5: Want to run multiple cronjobs through kernel.php under App/Console
- swift - Ipad上的自动布局奇怪行为
- html - 弹性基础:自动在 IE11 中不起作用
- sql - 每次修改表时运行脚本
- node.js - 如何在 React 中使用使用“window”引用的组件与服务器端渲染?
- c# - 使用 Func 和 Expression Func 运行查询之间的差异