XPath JMeter断言:错误“前缀必须解析为名称空间". [英] XPath JMeter Assertion : Error "prefix must resolve to a namespace"
问题描述
我正在尝试在标签值上使用 JMeter XPath声明作为下面使用XPath断言命令:
I am trying to use JMeter XPath Assertion on a tag value as below with XPath assertion command:
//m:CurrencyNameResul/text() = Pounds
网络服务响应:
<?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>
我遇到错误
前缀必须解析为名称空间
prefix must resolve to a namespace
并参考下面的JMeter手册:
and after referring to JMeter manual below:
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
我不明白,所以我的问题是:
I don't get it, so my questions are:
- 属性文件的内容应该是什么?
- 要放在哪里?
推荐答案
以下是操作步骤:
在jmeter/bin文件夹中创建一个名为namespaces.properties的文件,其中包含:
Create in jmeter/bin folder a file named namespaces.properties containing:
m = http://www.oorsprong.org/websamples.countryinfo
m=http://www.oorsprong.org/websamples.countryinfo
在user.properties中设置:
In user.properties set:
xpath.namespace.config = namespaces.properties
xpath.namespace.config=namespaces.properties
最后将您的断言修正为包含以下内容:
Finally fix your assertion to contain:
//m:CurrencyNameResult ='磅'
//m:CurrencyNameResult = 'Pounds'
并选中使用命名空间"
最后得到:
这篇关于XPath JMeter断言:错误“前缀必须解析为名称空间".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!