Forum Discussion
3 Replies
Sort By
- Liberty_InformaRegular Contributor
- RobWithersOccasional ContributorSo I am looking into using the DOMBuilder to parse the xml then process the nodes, removing the '?'. All of this works. However, when I attempt to set the "Request" back into the testStep ("WsdlTestRequestStep"), it does not stick.
Here's my code:for(testStep in testRunner.getTestCase().getTestStepList()) {
if(testStep.getClass().getSimpleName().equalsIgnoreCase("WsdlTestRequestStep")) {
myRequest = testStep.getPropertyValue("Request")
reader = new StringReader(myRequest)
doc = DOMBuilder.parse(reader)
root = doc.documentElement
use(DOMCategory) {
items = root.'**'.findAll{ it.text() == '?' }
items.each{ item ->
item.value = ''
}
}
myRequest = XmlUtil.serialize(root)
log.info(myRequest)
testStep.setPropertyValue("Request", myRequest)
}
}
How can I set the request of a testStep with my new xml?
Thanks,
Rob - SmartBear_SuppoSmartBear Alumni (Retired)Hey Rob,
Sorry for the slow response. Normally we don't actually support groovy, but I tried anyway and didn't manage to reproduce this issue. When using your groovy code snippet, I found that it correctly saves the request and actually uses the new, stripped request. (However, it does seem to break requests that use more than one parameter, deleting all parameters except for the last one).
Is this still an issue for you? Let me know and I'll see if I can help.
Regards,
Arian
SmartBear Sweden
Related Content
Recent Discussions
- 4 days agominhng