Can we save all SOAP responses from test step inside TestSuite with SOAPUI?
I try to save all responses through DATA export , but its only showing me summary result
To save all response from a testSuite you can add a tearDown script which is executed at the end of testSuite execution. This groovy script loops over each testCase in the testSuite saving to disk each testStep response:
// 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 ->
// to avoid problems with testSteps which not has response value (such as groovy script)
def response = testStep.getProperty('Response')?.getValue()
if(response){
// define a file
def file = new File(folderPathSuite + testStepName + '_response.xml')
// get the response and write to file
file.write(response)
}
}
}
The tearDown script tab in testSuite panel: `

If instead, as you commnet you want all responses in one file you can do the same in tearDown script but using this code:
// create file to write all responses
def allResponses = new File('C:/temp/' + testSuite.name + '_' + "AllResponses.xml")
def ls = System.getProperty("line.separator")
// for each testCase
testSuite.testCases.each { testCaseName, testCase ->
allResponses << "TESTCASE: ${testCaseName}${ls}"
// for each testStep
testCase.testSteps.each { testStepName, testStep ->
allResponses << "TESTSTEP: ${testStepName}${ls}"
// to avoid problems with testSteps which not has response value (such as groovy script)
def response = testStep.getProperty('Response')?.getValue()
if(response){
// save the response to file
allResponses << response + ls
}
allResponses << "END TESTSTEP: ${testStepName}${ls}"
}
allResponses << "END TESTCASE: ${testCaseName}${ls}"
}
If as you comment you want all this data in a .xls column, you need some external libraries to work with .xlsas for example Apache POI. IMO that is too much tricky to do so in your test.
If you want to do it anyway, take the Apache POI jars and copy it on SOAPUI/bin/ext folder, then restart SOAPUI in order to load the libraries. Now groovy script on your SOAPUI are ready to work with .xls using Apache POI classes. Here is a little example to start with groovy and Apache POI.