Forum Discussion
Thank you for posting to our Community Forum.
You can use a Groovy Script TestStep to pull data from a Response and store it as a TestCase Property.
- Add a Groovy Script TestStep after the Request TestStep
- Right-Click the editor and Select "Get-Data"
- Navigate to the Request TestStep and Select "ResponseAsXML"
- In the "Select XPath" tool, select the ID field
ReadyAPI will generate a property expansion expression stored as a def.
In the next line, you need to store the value as a TestCase Property as shown here:
context.testCase.setPropertyValue("Property Name", <Name of Def>)
At this point, we now have a TestCase custom property that will be dynamically set to the xml fields value according to the Response.
In the subsequent JDBC TestStep, we can utilize the "Get Data" menu (if available) or write Property Expansion expressions to pull this TestCase property value to make dynamic queries.
Get Data Documentation: https://support.smartbear.com/readyapi/docs/testing/properties/get-data.html
Property Expansion Documentation: https://support.smartbear.com/readyapi/docs/testing/properties/expansion.html