试图在这篇文章中回答这个问题: Jmeter- NonGUIDriver java.lang.IllegalArgumentException 中的错误, 但解决方案不起作用,想知道其他人是否有其他解决方案或可以澄清解决方案......
我正在尝试运行 Jmeter Maven 插件(2.1.0 版)来运行我的 Jmeter 脚本,该脚本是用 Jmeter 3.1 版编写的。我按照这里提到的所有说明https://github.com/jmeter-maven-plugin/jmeter-maven-plugin创建 pom.xml 文件。
当我执行以下 Maven 命令时:
mvn clean verify -Denv=prod -Djmx.filename={the_name_of_my_jmx_file}
我收到以下 2 个错误:
1
[INFO] Invalid value detected for <postTestPauseInSeconds>. Setting pause to 0...
2
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from: {path to my jmx file} missing class com.thoughtworks.xstream.converters.ConversionException:
[INFO] ---- Debugging information ----
[INFO] cause-exception : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message :
[INFO] first-jmeter-class : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
[INFO] class : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type : org.apache.jorphan.collections.ListedHashTree
[INFO] converter-type : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[2]/kg.apc.jmeter.reporters.LoadosophiaUploader
[INFO] line number : 2051
[INFO] version : 3.1 r1770033
我正在使用的 pom.xml 文件在这里:
http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0
<groupId>com.company.testframework</groupId>
<artifactId>test-project-performance</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Performance test script for project</name>
<properties>
<jmeter.version>3.1</jmeter.version>
<jmeter.maven.plugin>2.1.0</jmeter.maven.plugin>
<!-- <jmeter.maven.plugin>1.10.1</jmeter.maven.plugin> -->
<jmeter.plugins.standard>1.1.3</jmeter.plugins.standard>
<jmeter.plugins.extras>1.3.1</jmeter.plugins.extras>
<!-- <jmeter.plugins.extras>1.4.0</jmeter.plugins.extras> -->
<env>prod</env>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>src/test/resources/conf/${env}.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.maven.plugin}</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterVersion>${jmeter.version}</jmeterVersion>
<resultsFileFormat>xml</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<suppressJMeterOutput>false</suppressJMeterOutput>
<ignoreResultFailures>false</ignoreResultFailures>
<overrideRootLogLevel>INFO</overrideRootLogLevel>
<downloadExtensionDependencies>false</downloadExtensionDependencies>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins:pom:1.3.1</artifact>
</jmeterExtensions>
<propertiesUser>
<environment>${env}</environment>
<jtl_file_name>${jmx.filename}.jtl</jtl_file_name>
<project_build_directory>${project.build.directory}</project_build_directory>
<!-- Project Specific Properties -->
<main_threads>${main.threads}</main_threads>
<rampup_seconds>${rampup.seconds}</rampup_seconds>
<duration_seconds>${duration.seconds}</duration_seconds>
<host_url>${host.url}</host_url>
<user_name>${user.name}</user_name>
<user_password>${user.password}</user_password>
<offer_id>${offer.id}</offer_id>
</propertiesUser>
<propertiesJMeter>
<jmeter.save.saveservice.autoflush>true</jmeter.save.saveservice.autoflush>
<jmeter.save.saveservice.output_format>csv</jmeter.save.saveservice.output_format>
<jmeter.save.saveservice.assertion_results_failure_message>false</jmeter.save.saveservice.assertion_results_failure_message>
<jmeter.save.saveservice.data_type>true</jmeter.save.saveservice.data_type>
<jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>
<jmeter.save.saveservice.response_code>true</jmeter.save.saveservice.response_code>
<jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>
<jmeter.save.saveservice.thread_name>true</jmeter.save.saveservice.thread_name>
<jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>
<jmeter.save.saveservice.assertions>true</jmeter.save.saveservice.assertions>
<jmeter.save.saveservice.latency>true</jmeter.save.saveservice.latency>
<jmeter.save.saveservice.bytes>true</jmeter.save.saveservice.bytes>
<jmeter.save.saveservice.url>true</jmeter.save.saveservice.url>
<jmeter.save.saveservice.thread_counts>false</jmeter.save.saveservice.thread_counts>
<jmeter.save.saveservice.sample_count>false</jmeter.save.saveservice.sample_count>
<jmeter.save.saveservice.timestamp_format>ms</jmeter.save.saveservice.timestamp_format>
<jmeter.save.saveservice.timestamp_format>yyyy/MM/dd HH:mm:ss.SSS</jmeter.save.saveservice.timestamp_format>
<httpclient4.retrycount>3</httpclient4.retrycount>
<httpsampler.await_termination_timeout>60</httpsampler.await_termination_timeout>
<http.socket.timeout>20000</http.socket.timeout>
</propertiesJMeter>
<testFilesIncluded>
<jMeterTestFile>${jmx.filename}.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
<dependencies>
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-standard</artifactId>
<version>${jmeter.plugins.standard}</version>
</dependency>
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-extras-libs</artifactId>
<version>${jmeter.plugins.extras}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>