代码之家  ›  专栏  ›  技术社区  ›  paul

Jmeter:在windows中运行的测试计划在Centos中失败了

  •  0
  • paul  · 技术社区  · 6 年前

    我有一个有两个线程的测试计划。

    \testdata\csvtest1.csv 此目录位于 src\test\jmeter\testdata 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
    

    所以我手动复制粘贴的测试数据目录,其中两个CSV文件都在Jmeter的bin目录中。不过,它给出了同样的错误。

    jMeter java.lang.IllegalArgumentException: File example.csv must exist and be readable 对答案发表了评论,但没用。

    我做错什么了吗?

    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>
    
    2 回复  |  直到 6 年前
        1
  •  0
  •   Community Rick James    4 年前

    documentation ?

    引用JMX文件和CSV数据

    一旦创建了JMeter测试,就需要将它们复制到 <Project Dir>/src/test/jmeter

    所以:

    1. 复制你的 csvtest1.csv , csvtest2.csv src/test/jmeter 文件夹
    2. 在CSV数据集配置元素中仅按名称引用它们,即。

    看到了吗 Five Ways To Launch a JMeter Test without Using the JMeter GUI 有关运行JMeter测试的各种方法的更多信息,包括使用JMeter Maven插件。

        2
  •  0
  •   Frito    6 年前

    尝试使用/(斜杠)作为文件分隔符,并确保执行测试计划的用户可以读取这些文件。