Forum Discussion
Thank you for your compliment ChrisA,.
PFB the code. I hope this solve all issues. Let me know, if you see any other issues.
Code::
def testSuiteFolder = "C://Users//sreddy40//Desktop//proj//"+testSuite.name + '_' + System.currentTimeMillis() + File.separator
new File(testSuiteFolder).mkdirs()
testSuite.testCaseList.each{
def testCaseFolder =testSuiteFolder+"//"+"${it.name}"
new File(testCaseFolder).mkdirs()
it.testStepList.each{
if (it.toString().contains("wsdl.teststeps.RestTestRequestStep")){
def request = new String (it.getTestRequest().getResponse().getRawRequestData())
def response = it.getProperty('Response').getValue()
def requestFile = new File(testCaseFolder+"//"+it.name+"request.txt")
def responseFile = new File(testCaseFolder+"//"+it.name+"response.json")
requestFile.write(request)
responseFile.write(response)
} else {
}
}
}
- Sirisha20204 years agoContributor
Hi Redde,
I am still facing some issues. We have test suite having around 100 + test cases. In which request and response is generating for 7 test cases. It is not generating for the remaining test cases. I tried to remove failed test cases to verify whether the script works fine for pass test cases. But no luck. it is not creating the test cases after 7 test cases. I am attaching the SOAP UI Log, error log as well as request type details( REST request which the other day Chris has asked me to check the type of request by providing the code). Please look into this.
Please find the errors as below:
Tue Oct 27 06:51:55 EDT 2020:ERROR:nu.xom.MalformedURIException: Double slash (//) in path
nu.xom.MalformedURIException: Double slash (//) in path
Tue Oct 27 06:54:47 EDT 2020:ERROR:java.lang.NullPointerException: Cannot invoke method getRawRequestData() on null object
Please find logs in the attached docs.
Code:
def testSuiteFolder = "C:/Users/sreddy40/Desktop/proj/"+testSuite.name + '_' + System.currentTimeMillis() + File.separator
new File(testSuiteFolder).mkdirs()testSuite.testCaseList.each{
def testCaseFolder =testSuiteFolder+"/"+"${it.name}"
new File(testCaseFolder).mkdirs()
it.testStepList.each{
if (it.toString().contains("wsdl.teststeps.RestTestRequestStep"))
{
def request = new String (it.getTestRequest().getResponse().getRawRequestData())
def response = it.getProperty('Response').getValue()
def requestFile = new File(testCaseFolder+"/"+it.name+"request.doc")
def responseFile = new File(testCaseFolder+"/"+it.name+"response.doc")
requestFile.write(request)
responseFile.write(response)}
else {
}
}
}I have removed "//" in the path. I did not change anything apart from this. As I was getting the error Double slash (//) in path.
Thanks.
Related Content
- 6 years agopankajmalinda
- 7 years agoKate
- 7 years agomoolickj
- 9 years agomaximojo