Forum Discussion
To your question, yes it can be done using groovy. And I believe there can be multiple ways.
a. have soap request, jdbc step, then groovy step. then process both the responses to assert.
b. Have groovy step, and also have soap and jdbc steps. Call other two steps as from groovy so that you can have total control in the script itself as objects.
Coming to your doubt - node names different. It should be a matter as long as you understand both the formats of response.
Get all the values from soap response to be asserted with jdbc using xpath, similarly get all the values from jdbc using xpath and then do the assertion for each element.
Thanks for your reply!
As you mentioned, I have soap request and jdbcc step and I have assertions added to both. I am quite new to groovy, so I am not familiar to calling test steps within the script and do a compare.
Here is a sample script I tried to obtain my node values from soap request . The X path mentioned in the GetNodeValues works only when I give the path upto the node . This does not work for me since the response is pretty huge and i can validate every single node separately
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder= groovyUtils.getXmlHolder("Max -UpdateAccountShipTo#Response")
holder.namespaces["ns1"]="http://tigerpaw.com/service/"
holder.namespaces["a"]="http://tigerpaw.com/contract/"
for (item in holder.getNodeValues("//ns1:UpdateAccountShipToResponse/ns1:UpdateAccountShipToResult/a:ShipTo"))
log.info "item/:[$item]"
This outputs item:[]
Howvere if I i modify getNodeValues ("//ns1:UpdateAccountShipToResponse/ns1:UpdateAccountShipToResult/a:ShipTo/a:Name"
outputs item [Name]
- nmrao9 years agoChampion Level 3If that xml is too large get each value and compare, alternative could be transform one of the response to other format so that both can be compared using some library like xmlunit or so.
In order to transform an xml into other format, you need to write an xslt file.
Related Content
- 2 years agojerry91
- 9 months agoKimdoengart
Recent Discussions
- 14 days agosmilnik