SaopUI GroovyScript - How to modify request XML located in another TestCase?

青春壹個敷衍的年華 提交于 2019-12-12 05:00:03

问题


I am trying to modify a request from another testCase and I'm unable to get its XML.

I'd like to know the parameter pattern to get it with this method :

def holder = groovyUtils.getXmlHolder( targetStep.getName() + "#Request" )

This method seems to look for "targetStep" in its own testCase. I'd like to know how to specify to this method that I'm looking for "targetStep" in a specific testCase.

If it's not possible that way, I'd like to know how to get the XML Content of a testStep in a specific testCase in order to modify node values.

Thanks in advance !


回答1:


Finally found an alternative :

def holder = groovyUtils.getXmlHolder( targetStep.getPropertyValue("request") )  
holder.setNodeValue("//NodeName",'newValue')
holder.updateProperty()
targetStep.getHttpRequest().setRequestContent(holder.getXml())


来源:https://stackoverflow.com/questions/31474938/saopui-groovyscript-how-to-modify-request-xml-located-in-another-testcase

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!