go2khurram
10 years agoContributor
SoapUI Teardown Script
I have found the below teardown script from one the blog to save the request and response in to a folder /files.
It works fine when I have only SOAP request steps but did not work for other types of steps. I have property transfer, groovt script, JDBC Request, Delay and SOAP request in my steps , but only intrested to record request and response of SOAP Request.
// path for the testSuite
def folderPath = 'C:/temp/' + testSuite.name + '_' + System.currentTimeMillis() + File.separator
new File(folderPath).mkdirs()
// for each testCase in the testSuite
testSuite.testCases.each { testCaseName, testCase ->
// path for this testCase
def folderPathSuite = folderPath + testCaseName + File.separator
new File(folderPathSuite).mkdir()
// for each testStep
testCase.testSteps.each { testStepName, testStep ->
// define a file
def file = new File(folderPathSuite + testStepName + '_response.xml')
// get the response and write to file
file.write(testStep.getProperty('Response').getValue())
}
}