01 March 2010 - 3.5 |
Property Transfers are TestSteps that transfer properties between Property Containers within the same scope as the
PropertyTransfer TestStep (ie its containing TestCase, TestSuite, Project and Goal Properties).
The step can contain an arbitrary number of "transfers" specifying a source and destination property with optional
XPath/XQuery expressions.
Property Transfers use the same Saxon XPath/XQuery engine as described for the XPath/XQuery Assertion. | ![]() |
The Property Transfer editor is opened by double clicking a PropertyTransfer step either in the navigator or in the TestCase editors' TestStep list.
The editor contains a list of configured transfers to the left, selecting a transfer in the list will display that transfers source and destination XPath/XQuery expressions to the right.
Use the top right ComboBoxes to specify the source or property to be transferred, the target or property is specified with the combo boxes in the middle. If the properties contain XML an accompanying XPath expression can be specified to further select the value to transfer from or moving to. soapUI Pro adds an XPath Selector for GUI XPath Creaction button to the right of these combo boxes for easily selecting the source or target XPath expression from the selected source or target property.
The following actions are available from the top toolbar
A "Transfer Log" inspector at the bottom of the editor displays all transfers performed by this PropertyTransfer while the editor has been open, including both those performed using one of the toolbar buttons and those performed during a TestCase/TestSuite run. The Transfer Logs toolbar contains a "Clear" button to clear its current contents.
Upon execution during a TestCase run, each transfer in the Property Transfer is performed by selecting the property specified by the transfers source step, property and optional XPath expression and copying their value(s) to the destination steps specified property using an optional XPath expression.
If XPath expressions are specified, soapUI will try to replace the target node with the source node if they are of the same type. If not (for example when assigning text() to an @attribute), soapUI will do its best to copy the value as possible.
Source and target XPath expressions must both point to existing nodes in their respective properties, the source property obviously requires the node so it can be selected, the target property requires the node so it can be found and overwritten.
If any of the transfers fail due to missing matches of any of the XPath expression, an error is printed and the step will either fail or go on, depending on of the "fail on error" option has been selected for that transfer. TestCase execution is only aborted if the TestCases' "Fail on error" option has been set as described for under TestCase Options.
The following options are available for each transfer:
A Property Transfer can be created as follows:
//ns1:SessionId
which will result in the sessionID element being copied
from the preceding response to the following request (where it must be available but preferably empty)with soapUI Pro creating property transfers is greatly simplified using the corresponding Response Wizards which perform most of the above steps automatically.
The following sample is also included in the sample project included in the offline distribution:
Set up 2 requests to the Amazon Web Service defined at (http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl);
<soapenv:Envelope xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:ItemSearch> <ns:SubscriptionId>- your subscription id here-</ns:SubscriptionId> <ns:Request> <ns:SearchIndex>Books</ns:SearchIndex> <ns:Title>Oxford</ns:Title> </ns:Request> </ns:ItemSearch> </soapenv:Body> </soapenv:Envelope>
and
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15"> <soapenv:Body> <ns:ItemSearch> <ns:SubscriptionId>- your subscription id here -</ns:SubscriptionId> <ns:Request> <ns:Author>?</ns:Author> <ns:SearchIndex>Books</ns:SearchIndex> </ns:Request> </ns:ItemSearch> </soapenv:Body> </soapenv:Envelope>
and then create the following transfer which moves the first author from the
first requests "response" property to the author
request element in the following steps "request"
property;
Source XPath:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15'; (//ns:Author)[1]
Target XPath:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15'; (//ns:Author)[1]