SoapUI - Property Transfer



Sometimes there is a requirement to extract some value from a response message and include it in the subsequent request(s). In such a case, we need to have a mechanism to retrieve a specified value and transfer it to the other elements of the project. SoapUI supports such functionality through the Property Transfer TestStep.

Adding Property Transfer

Step 1 − Select the TestCase or TestStep, right-click → Add Steps → Property Transfer.

Adding Property

Step 2 − Enter the TestStep name and Click OK.

Rate Transfer

Step 3 − RateTransfer step is added and a new wizard will open.

New Wizard

Step 4 − Click the Adds a new property transfer icon + at the top-left corner in the property transfer window. It will be prompted to enter a name for the transfer. Enter Rate and click OK.

Rate

Transferring a Property

Once the transfer is created, Source and Target panes need to specify the relevant XPath expressions to extract and replace the property values. In the drop-down box next to Source, various levels of SoapUI projects are listed that can be used as the source of property transfers. By default, the closest TestStep will be shown.

In this case, it is the Request – INR to USD TestStep. The drop-down list next to Property shows the source property which is used in the transfer, which can either be request, response, or service endpoint.

Transfer Property

Step 1 − Select Response and go to Path language. The user can select XPath, Xquery, or Jason to define the property. In this case, select XPath.

Path Language

Step 2 − To get the declaration of source xml, click ns and specify XPath.

Step 3 − Specify the target where the value extracted from the above XPath expression is to be transferred. The target pane is used at the bottom of the property transfer window for that.

Step 4 − Transfer extracted value of ConversionRateResult from response of RequestINRtoUSD step.

Target − Properties

Property − ConversionRate (a new property added, it doesn’t have any value initially).

Target Property

Step 5 − Once the test case runs successfully, property “ConversionRate” gets updated based on the response.

Following is the screenshot initially.

Conversion Rate

Following is the screenshot after a successful run.

Successful Run

Similarly, Target may be a next Request XML. If Target is SOAP request, we need to provide XPath to identify the target attribute.

Advertisements