Forum Discussion
KarelHusa
10 years agoSuper Contributor
You can store all requests and responses of the test steps included in a test case with the following script.
You need to:
1. set the TearDown script of the test case to the code bellow.
2. define the 'outputDirectory' property on the project level to the required path, e.g. /C:/testing/out
File outDir = new File(testRunner.testCase.testSuite.project.getPropertyValue( "outputDirectory") + "/" + testRunner.testCase.testSuite.getName() + "/" + testRunner.testCase.getName())
outDir.mkdirs()
File reponseFile
File requestFile
testRunner.results.each { // WsdlTestRequestStepResult
requestFile = new File(outDir, it.getTestStep().getName() + "-Request.xml")
responseFile = new File(outDir, it.getTestStep().getName() + "-Reponse" + "-" + it.getStatus() + ".xml")
requestFile << it.getRequestContent()
responseFile << it.getResponseContent()
}