Forum Discussion
Hi Suraj,
I'm not sure if this is 100% correct, this is just my understanding:
Both options are calling constructors in this class:
https://www.soapui.org/apidocs/com/eviware/soapui/support/XmlHolder.html
but the 1st option is invoking this one - XmlHolder(String xml)
the 2nd is calling this - XmlHolder(PropertyExpansionContext context, String propertyRef)
The second option is creating object of this class:
https://www.soapui.org/apidocs/com/eviware/soapui/support/GroovyUtils.html
and then calling this method:
getXmlHolder(String xmlPropertyOrString)
Therefore this String:
"Request 1#Response"
can be parsed into 2 params - Request 1 and Response so it could be used in the constructor with 2 params.
The advantage is that you can specify TestStep (only in your current TestCase) and its property and the XmlHolder will create the holder from it.
An example to understand it:
it much more simplier to write this - def holder = groovyUtils.getXmlHolder( "Request 1#Response" )
instread of this - def holder = new XmlHolder(testRunner.testCase.testSteps["Request 1"].getPropertyValue("Response"))
You can still use groovyUtils's holder as follows:
groovyUtils.getXmlHolder(messageExchange.responseContentAsXml)
To sum up, the groovyUtils's holder is giving you more options to create the actual xml holder.
Does it make sense to you?
Regards,
Marek
Not compltely clear,
above explanation tells whats happeing when each option is used.
Do you agree that both serve the same purpose?
What I wanted to know is which to use when ?
If any one has advatage over other option?
- nmrao10 years agoChampion Level 3I think soapui api is available online, you can go thru it.
GroovyUtils is a utility class that has a method which will return XmlHolder object. I feel what you using should be fine as per your description and need as you are creating XmlHolder object directly.
Is there any specific issue or scenario that needs to clarified?
Related Content
- 5 years ago
Recent Discussions
- 9 days ago