【发布时间】:2016-06-02 11:23:18
【问题描述】:
我试图在 SOAPUI 中将响应从一个测试用例转移到另一个测试用例。这样我就可以按国家搜索并检索要使用的货币代码,然后按货币代码搜索。但是我不确定我的 xpath 是否正确。
使用的 SOAP WSDL:http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
这是对即将交付的服务的一种做法。
初始测试用例发布
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET">
<soap:Header/>
<soap:Body>
<web:GetCurrencyByCountry>
<!--Optional:-->
<web:CountryName>Belgium</web:CountryName>
</web:GetCurrencyByCountry>
</soap:Body>
</soap:Envelope>
回应
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCurrencyByCountryResponse xmlns="http://www.webserviceX.NET">
<GetCurrencyByCountryResult><![CDATA[<NewDataSet>
<Table>
<Name>Belgium</Name>
<CountryCode>be</CountryCode>
<Currency>Franc</Currency>
<CurrencyCode>BEF</CurrencyCode>
</Table>
<Table>
<Name>Belgium</Name>
<CountryCode>be</CountryCode>
<Currency>Franc</Currency>
<CurrencyCode>BEF</CurrencyCode>
</Table>
</NewDataSet>]]></GetCurrencyByCountryResult>
</GetCurrencyByCountryResponse>
</soap:Body>
</soap:Envelope>
然后我正在使用属性转移测试步骤,首先将下拉菜单设置如下:
Source: Get Currency by Country; Property: Response Path Language: xpath
然后声明xpath如下:
declare namespace sam= 'http://www.webserviceX.NET';//GetCurrencyByCountryResult/table[2]/CurrencyCode
每次运行测试时,我都会收到 Null 响应。我尝试使用通配符,但仍然无法获取值。
【问题讨论】:
-
请注意使用的网络服务实际上是webservicex.net/New/Home/ServiceDetail/17