I want to save the request and response on test suite level
Hi,
I have requirement to save the request and response on test suite level. Also we have to save the request and response in different folders costumer and sales rep(i.e. Filtering the test case response files based on test case name and saving them in respective folders). I am working on the below mentioned script with which i am not getting response files for the test cases that are there in test suite.
code ;
def folderPath = "C:/Users/SS/Desktop/proj/" + 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 ->
def response = testStep.getProperty('Response').getValue()
if(response){
// define a file
def file = new File(folderPathSuite + testStepName + '_response.json')
// get the response and write to file
file.write(response)
}
}
}
Thanks in advance.