Property Transfer TestSteps are used to transfer properties between TestSteps(Requests) and their containing TestCase, TestSuite and Project. They are extremely useful in a number of situations, especially when properties containing XML are involved.
This tutorial involves,
Extracting a value from an XML message
Write a value into an XML message
Transfer complex XML content between properties
** Update – Complete SoapUi Tutorials now available here
Follow the steps below to transfer properties between TestSteps inside a testsuite.
Step 1: To transfer property within the request, right click on a teststep and select Insert step–> Property Transfer from the dropdown menu.
Step 2: In the Insert Step window, enter a userdefined name for the property transfer teststep and click OK.
Click on icon to add new property transfer to the property transfer editor window.
Enter property transfer name and click OK in the Add transfer to add the property to the property transfer editor window as shown in the image below.
The various tabs and options available in the property transfer editor window are as follows.
The Source area at the top specifies the source property and optional XPath for the transfer
The Target area under that specifies the target property and optional XPath for the transfer
The area below that holds different configuration options set on a transfer to transfer level.
The Transfer Log at the bottom shows the latest executed transfers while the window was open and their actual transferred values.
The available configuration options can drastically change what is transferred and their respective is defined as:
Fail transfer on error – The transfer step will fail in case any errors happen while attempting to perform the transfer
Transfer text content – Only text content will be transferred. No structural elements will be preserved
Transfer to all – The matched values will be transferred to all the target locations in case there are several that matches
Entitize transferred values – The values will have certain characters for example ampersand (“&”) replaced with it’s corresponding character entity value (“&”)
Set null on missing source – The target will be set to null in case the source resource is missing. This means that if the target already has a value it will be lost
Ignore empty/missing values – This means that if the matched value of the source is empty or missing it will be ignored and the target value left untouched
Use XQuery – SoapUI will assume that the source is XQuery rather than the default XPath when trying to extract the source values
Transfer child nodes – SoapUI will not attempt any textual extraction from the matched source node but rather pick the children of the matched node and thus preserving the subtree XML structure
Now in the property transfer teststep editor window, choose the source property and the target property by providing the xpath as shown in the image below.
Now click on run icon to test whether the property is getting transferred successfully. The result can be viewed in the transfer log as shown in the image below.
Before running the property transfer editor, check if the source property (xpath) is not empty/null. Otherwise the property value while property transfer will be null (since Set null for missing source option is checked).
Running the testcase to check property transfer:
Now, let’s run the testcase to check whether the property is getting transferred successfully between the requests. Follow the steps discussed below to verify property transfer is successful.
Now click on the testcase name to run the teststeps available in the testcase in the editor window as shown in the image below.
Click on run icon to execute the property transfer in the testcase.
Thus properties can be transferred between requests (from xml content) at testcase level.