Examples of Using Properties

Applies to ReadyAPI 3.9, last modified on July 29, 2021

This topic contains examples of using properties in request parameters and bodies.

Using Response Data in Subsequent Requests

In this example, we use the SOAP Sample Project, shipped with ReadyAPI. In this project, we have the Simple Search TestCase test case that declares a username/password, calls a login action to get the session ID, then calls a search with the session id parameter, and finally calls the logout with the session ID parameter.

  • Open the Simple Search TestCase test case:

    Add to TestCase
  • Open the Test Request – login test step and run the request.

    Note: The test step sends a request to the virtual service, so make sure it is running:
    • Expand the APIs (Virtual) node in the Navigator.

    • Right-click the virtual service and select Start.

    In the response tab, you can see the received response:

    Testing web services with ReadyAPI: Received response

    Click the image to enlarge it.

  • Open the Test Request – logout test step.

  • This request already has a username parameter filled with the Property Transfer test step, but, for demonstration purposes, we will replace that with the property expansion.

    In the Form panel, click the ellipsis button next to the sessionid field:

    Testing web services with ReadyAPI: The Form panel

    Click the image to enlarge it.

  • In the Get Data dialog, specify the Response property of the first SOAP Request test step and click Add:

    Testing web services with ReadyAPI: Get Data dialog

    Click the image to enlarge it.

  • ReadyAPI determines that the specified property contains an XML content and opens the Select XPath dialog. Select the sessionid element and click OK:

    ReadyAPI specifies the property expansion to get the selected value.:

    ${Test Request – login#Response#declare namespace sam='http://www.soapui.org/sample/'; //sam:loginResponse[1]/sessionid[1]}

  • When you run the request again, you can see that the actual session ID value has been used in the Raw request view:

Conditional Inline Property Expansions

You can conditionally expand a property in a request or similar entities, using the third custom property’s value. For example, the selection test case property has the selection value. To expand the myFirstXMLSnippet and mySecondXMLSnippet properties in it, use the following code:

${= testCase.getPropertyValue( "selection" ) == "first" ? testCase.getPropertyValue( "myFirstXMLSnippet" ) : testCase.getPropertyValue( "mySecondXMLSnippet" )}

Passing XML Data by Using Property Expansions

During the test run, ReadyAPI replaces the property expansion with the value of the property the expansion points to. In some cases, the value may be XML data. If ReadyAPI inserts it as is, the message format may break (the message may become ill-formed). To avoid this, include the property expansion in the CDATA section. For example:


Note that you can insert CDATA only in the XML Editor.

See Also

About Properties
Transferring Property Values

Watch the video
Highlight search results