我试图使用XPath断言命令在标签值上使用JMeter XPath Assertion:
//m:CurrencyNameResul/text() = Pounds
Web服务响应:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:CurrencyNameResponse xmlns:m="http://www.oorsprong.org/websamples.countryinfo">
<m:CurrencyNameResult>Pounds</m:CurrencyNameResult>
</m:CurrencyNameResponse>
</soap:Body>
</soap:Envelope>
我收到了错误
前缀必须解析为命名空间
并在参考下面的JMeter手册后:
NAMESPACES As a work-round for namespace limitations of the Xalan XPath parser implementation on which JMeter is based, you can provide a Properties file which contains mappings for the namespace prefixes:
prefix1=Full Namespace 1
prefix2=Full Namespace 2
…
You reference this file in jmeter.properties file using the property:
xpath.namespace.config
我不明白,所以我的问题是:
您可以修改XPath查询以使用name()函数,如:
(//*[name() = 'm:CurrencyNameResult'])/text()
你不必搞乱修改属性,重启JMeter等等。
此外,如果您使用local-name()函数,则不必在查询中包含名称空间前缀:
(//*[local-name() = 'CurrencyNameResult'])/text()
更多信息: