Forum Discussion
sonya_m
5 years agoSmartBear Alumni (Retired)
Thanks for the query!
Let's asl the Community to help, perhaps some folks faced similar use cases.
PrathapR ChrisA HimanshuTayal groovyguy avidCoder
any thoughts?🙂
- ChrisA5 years agoContributor
Hi,
Before looking at writing requests and responses, are you sure your script is correctly iterating over the test steps and 'picking' up the step name?
Try using log.info to check. E.g. in your loop....
testSuite.testCases.each { testCaseName, testCase -> log.info("TestCaseName " + testCaseName); // path for this testCase def folderPathSuite = folderPath + testCaseName + File.separator; new File(folderPathSuite).mkdir(); // for each testStep testCase.testSteps.each { testStepName, testStep -> log.info("TestStepName " + testStepName); def response = testStep.getProperty('Response').getValue(); log.info(response); if(response){ // define a file def file = new File(folderPathSuite + testStepName + '_response.json') // get the response and write to file file.write(response) }
- Sirisha20205 years agoContributor
The below code is not working and it is giving some errors
- ChrisA5 years agoContributor
Hi,
It will throw errors as it is incomplete, for example the loop is not closed.
It's purely an example excerpt from your original code just to suggest where you might want to try some logging to see if the loop is working as intended.
Related Content
- 7 years ago
- 8 years ago
Recent Discussions
- 15 hours ago