nonguidriver conversionexception中的错误com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion

时间:2015-09-02 01:47:52

标签: jmeter jmeter-maven-plugin

背景信息 - 我有一个jmeter测试计划,它正在验证json API调用。我想使用ATLANTBH jsonpathassertion组件,它似乎更简单,而不是正则表达式提取器,然后是断言。我使用jp @ gc - JSON Path Assertion添加了一个断言步骤,其示例JSON路径:$ .results [0] .fulfilments [0] .fulfilmentType与预期值

问题 在jmeter(2.1.3)中运行测试gui可以成功运行,但是无法从命令行或在jenkins环境中运行。我在pom中添加了jmeter-plugins

感谢您的帮助

<plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>1.10.1</version>
    <configuration>
        <testResultsTimestamp>false</testResultsTimestamp>
        <propertiesUser>
            <server>${server}</server>
        </propertiesUser>
   </configuration>
    <executions>
        <execution>
            <id>jmeter-tests</id>
            <phase>verify</phase>
            <goals>
                <goal>jmeter</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>kg.apc</groupId>
    <artifactId>jmeter-plugins</artifactId>
    <version>1.0.0</version>
</plugin>

Jmeter记录如下

    2015/09/02 11:21:29 ERROR - jmeter.JMeter: Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'C:\PP\functional-test\src\test\jmeter\BAT_Scenarios.jmx', conversion error com.thoughtworks.xstream.converters.ConversionException: com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
------------------------------- : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
-------------------------------
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
-------------------------------
cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
version             : 2.13 r1665067
-------------------------------
    at org.apache.jmeter.save.SaveService.readTree(SaveService.java:586)
    at org.apache.jmeter.save.SaveService.loadTree(SaveService.java:537)
    at org.apache.jmeter.JMeter.runNonGui(JMeter.java:750)
    at org.apache.jmeter.JMeter.startNonGui(JMeter.java:737)
    at org.apache.jmeter.JMeter.start(JMeter.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:264)
Caused by: com.thoughtworks.xstream.converters.ConversionException: com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
------------------------------- : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
-------------------------------
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
-------------------------------
cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
version             : 2.13 r1665067
-------------------------------
    at org.apache.jmeter.save.ScriptWrapperConverter.createConversionException(ScriptWrapperConverter.java:105)
    at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:99)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
    at org.apache.jmeter.save.SaveService.readTree(SaveService.java:559)
    ... 9 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
---- Debugging information ----
message             : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree[3]/hashTree/com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
line number         : 279
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:95)
    ... 19 more
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion
    at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at org.apache.jmeter.save.SaveService$XStreamWrapper$1.realClass(SaveService.java:94)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47)
    at com.thoughtworks.xstream.core.util.HierarchicalStreams.readClassType(HierarchicalStreams.java:29)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:70)
    at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 47 more

1 个答案:

答案 0 :(得分:1)

看起来您的POM配置不正确。我希望它看起来像这样:

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>tst</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<build>
    <plugins>
        <plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>1.10.1</version>
            <configuration>
                <testResultsTimestamp>false</testResultsTimestamp>
                <jmeterPlugins>
                    <plugin>
                        <groupId>kg.apc</groupId>
                        <artifactId>jmeter-plugins</artifactId>
                    </plugin>
                </jmeterPlugins>
            </configuration>
            <executions>
                <execution>
                    <id>jmeter-tests</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>kg.apc</groupId>
                    <artifactId>jmeter-plugins</artifactId>
                    <version>1.0.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
</project>

即使这样,如果您不使用Maven 3,也可能会遇到传递依赖问题:

https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/92

如果更新到jmeter-plugins的1.3.0版本,则会出现不同的传递依赖性问题:

https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/131

快点下一个Jmeter版本:/