XPath JMeter 断言:错误“前缀必须解析为命名空间" [英] XPath JMeter Assertion : Error "prefix must resolve to a namespace"

查看:79
本文介绍了XPath JMeter 断言:错误“前缀必须解析为命名空间"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在标记值上使用

I am trying to use JMeter XPath Assertion on a tag value as below with XPath assertion command:

//m:CurrencyNameResul/text() = Pounds

Webservice Response:

<?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>

I am getting error

prefix must resolve to a namespace

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:

  • what should be the content of Properties file?
  • where to put its path?

解决方案

Here is how to proceed:

Create in jmeter/bin folder a file named namespaces.properties containing:

m=http://www.oorsprong.org/websamples.countryinfo

In user.properties set:

xpath.namespace.config=namespaces.properties

Finally fix your assertion to contain:

//m:CurrencyNameResult = 'Pounds'

And check "Use Namespaces"

To end up with:

这篇关于XPath JMeter 断言:错误“前缀必须解析为命名空间"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆