我已将jmeter脚本与maven集成在一起。我也有jmeter插件管理器。运行它时,我得到java.lang.IllegalArgumentException
,这导致上述异常。我已经添加了对jmeter插件管理器和xstream的依赖,但是仍然出现相同的错误。
这里已经讨论了完全相同的问题,但是内容已被删除。 https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/194
pom文件-
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>test_framework</groupId>
<artifactId>api_test_plan</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dkc_api_test_plan</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ThreadCount.thread1>10</ThreadCount.thread1>
</properties>
<build>
<plugins>
<!-- jmeter plugin to run jmeter through maven build -->
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<resultsFileFormat>xml</resultsFileFormat>
<generateReports>false</generateReports>
<testResultsTimestamp>false</testResultsTimestamp>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins:pom:1.3.1</artifact>
</jmeterExtensions>
<!-- inputFile>${project.build.directory}/jmeter/results/CreateOrderLoadTest.jtl</inputFile -->
</configuration>
</plugin>
<!--surefire plugin to generate html reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<outputFolder>${project.build.directory}/target/surefire-reports</outputFolder>
<printReport>true</printReport>
<exportAll>true</exportAll>
</configuration>
</plugin>
<!-- plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-analysis-maven-plugin</artifactId>
<version>1.0.4</version> <configuration> <source>${project.build.directory}/jmeter/results/dkc_sales.jtl</source>
</configuration> <executions> <execution> <id>create-html-report</id> <phase>verify</phase>
<goals> <goal>analyze</goal> </goals> </execution> </executions> </plugin -->
</plugins>
<!-- https://mvnrepository.com/artifact/junit/junit -->
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_java</artifactId>
<version>3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-manager <dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-manager</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
</project> ```
-------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[INFO] Executing test: myFile.jmx
[INFO] Starting process with:[java, -Xms512M, -Xmx512M, -jar, ApacheJMeter-4.0.jar, -d, D:\Projects\....
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'D:\Projects\\target\jmeter\testFiles\myFile.jmx', 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[3]/hashTree[5]/hashTree[4]/hashTree[3]/com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor
[INFO] line number : 3610
[INFO] version : 4.0 r1823414
[INFO] -------------------------------
[INFO] Completed Test: D:\Projects\Project_Name\api_test_plan\target\jmeter\testFiles\myFile.jmx
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.003 s
[INFO] Finished at: 2019-04-19T12:53:28+05:30
[INFO] Final Memory: 38M/282M
[INFO] ------------------------------------------------------------------------
[INFO] Shutdown detected, destroying JMeter process...**strong text**
答案 0 :(得分:1)
不要像以前那样使用pom依赖项:
kg.apc:jmeter-plugins:pom:1.3.1
应该可以