Pages Navigation Menu

Coding is much easier than you think

Transfer property(SOAPUI)

Transfer property(SOAPUI)

 

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

 
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.
 
Property transfer teststep

 

Step 2: In the Insert Step window, enter a userdefined name for the property transfer teststep and click OK.
 
property transfer teststep name

 

Property transfer editor

 

Step 3:
 

Click on property add icon icon to add new property transfer to the property transfer editor window.
 
property name

 
Step 4:
 

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.
 
Property added success

 

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

 
Step 4:  
 
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.
 
Property step editor

 

Step 5:
 
Now click on run Run testsuite 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.

Note:   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).


 

Property step run

 

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.
 
Step 1:
 

Now click on the testcase name to run the teststeps available in the testcase in the editor window as shown in the image below.
 

 Run from testsuite

 
Step 2:
 
Click on runRun testsuite icon to execute the property transfer in the testcase.
 
Run success

 

Thus properties can be transferred between requests (from xml content) at testcase level.

SimpleCodeStuffs located at , India, Chennai . Reviewed by rated: 8.8 / 10