Parse XML Values
You can work with XML in your scripts. ReadyAPI provides custom methods used to get XML nodes and work with them. For information about advanced parsing of XML, see XML Parsing in ReadyAPI Test.
Where to use
There are several ways to run these scripts:
As a Groovy Script test step.
As a setup or teardown script on the test case level in functional tests.
Examples
Getting node values
To get XML node values, you use the groovyUtils
and XmlHolder
objects. Here is how you can get values from the Test Request – login request in the SOAP Sample project:
Counting Nodes
When you already have an XML, you can use normal operations to work with it. For example, to count the number of item
elements in the XML, use the following code: