背景信息 - 我有一个验证 json API 调用的 jmeter 测试计划。我想使用 ATLANTBH jsonpathassertion 组件,它似乎比正则表达式提取器和断言要简单得多。我添加了一个使用 jp@gc 的断言步骤 - JSON 路径断言与示例 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