Groovy script to get the request xml

2019-02-16 00:20发布

问题:

I can get the response xml using Groovy script. I need to get the request XML since I need to add 'assertion script' to my soap ui testing.

I am using the following code to get the response xml

def response = new XmlHolder(messageExchange.responseContentAsXml)

But I am not sure how to get the request xml of SOAPUI. Can anyone please help me in getting the request xml of SOPAUI?

回答1:

To get the request content as a string you can use

testRunner.testCase.testSteps["Name of your teststeup"].testRequest.response.getRequestContent()

More information on the SoapUI API can be found at http://www.soapui.org/apidocs/index.html?overview-summary.html. Have a look at the Request and Response class in particular for the methods and properties they provide