2015-09-22 12 views
0

我想弄清楚SoapUI,到目前为止它已经是一个很棒的工具。但是,我无法弄清楚财产转移的问题。我读过这么多,只是似乎无法找到我正在寻找的答案。SoapUI:将响应有效载荷值传输到新请求(不同的测试步骤)

我有一个请求:TC01_vorbereitenKunde

我收到下面的响应有效负荷回:

HTTP/1.1 200 OK 
X-Powered-By: Servlet/3.0 
SOAPAction: "http://..." 
Accept: text/xml 
Content-Type: text/xml; charset=UTF-8 
Content-Language: en-US 
Date: Tue, 22 Sep 2015 15:58:01 GMT 
Content-Length: 414 
Content-Encoding: gzip 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Body> 
    <nova-kunden:vorbereitenKundeResponse xmlns:nova-kunden="http://...> 
     <nova-kunden:vorbereitungKundeAntwort> 
     <status>true</status> 
     <tkid>31f64d0f-b076-4304-95ab-15cb0de38adb</tkid> 
     <meldungen/> 
     </nova-kunden:vorbereitungKundeAntwort> 
    </nova-kunden:vorbereitenKundeResponse> 
    </soapenv:Body> 

然后我想借此“tkid”值,并将其放置在以下的请求:TC02_offeriereLeistungen

我试过了:$ {TC01_vorbereitenKunde#Response#// tkid} “TC01_vorbereitenKunde”是响应有效负载无效的测试步骤的名称。

我错过了什么?提前感谢您的帮助!

+0

可能重复的[我如何解析这个XML在soapui](http://stackoverflow.com/questions/31990480/how-do-i-parse-this-xml-in-soapui) – SiKing

回答

1

有第一步脚本声明,如下所示:

import com.eviware.soapui.support.XmlHolder 
def xml = new XmlHolder(context.response) 
def responseValue = xml.getNodeValue("//*:tkid") 
assert null != responseValue, "Response does not have value" 
context.testCase.setPropertyValue('TK_ID', responseValue) 

在第二步中,使用$ {##的TestCase} TK_ID在需要的价值。

相关问题