Forum Discussion
Hi,
"Is there no other way to delete parent elements?". Sorry, I really don't know.
I've used SoapUI's data driven test functionality extensively. In the main, my test data wholly aligns to the payload, so I usually don't have to worry about empty nodes and having to remove them.
On the flip side, I have built validation tests where I'm checking for the existence (and non-existence) of nodes as well as testing expected response where some node is empty.
For this, I still use data-driven tests, but instead of squirting in individual values, I've squirted in the whole request. I've also used data driven tests where my Excel data is a path to a file and I've 'pulled in' the file contents using a Groovy script step. The files contain the whole request I want to send.
To sum up, whilst SoapUI may not always offer what you need, I've never not been able to use the functionality to work around such limitations.
If youre running ReadyAPI!, you could create an event handler to strip out the empty elements after the data has been extracted from your source but before its injected via your REST request, so you wouldnt have to build the xml using groovy.
For the event handler groovy youd just need to identify the xpath of the attributes you want stripped.
Ta
Rich
- DavidSEM_Admin4 years agoOccasional Contributor
HI richie
Thank you for your answer. Could you explain a little more about your idea with the event handler? I am using ReadyAPI 3.3.1.
I did an event handler with the mentioned script in my previous messages in this topic. I did an event "RequestFilter.filterRequest" and it didn't work. What went wrong?
This was the script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def stepName = context.getCurrentStep().getLabel()
def holder = groovyUtils.getXmlHolder(stepName + "#Request")for( item in holder.getDomNodes( "//*[. = '']" )){
holder.removeDomNodes("//"+item.nodeName)
}
Related Content
- 3 years ago
Recent Discussions
- 3 days ago