Forum Discussion
- ChrisAdamsChampion Level 3
Hi,
Pretty straightforward. Create a Groovy test step after the API call. In the Groovy step, add....
def myRequestStep = testRunner.testCase.getTestStepByName(['SOAP Request']); // Substiture 'SOAP Request' with your step name. def rawRequest = new String(myRequestStep.testRequest.messageExchange.rawRequestData); def rawResponse = new String(myRequestStep.testRequest.messageExchange.rawResponseData); // Log the raw request and raw response log.info(rawRequest); log.info(rawResponse); // Create the file for the request and write to it. def requestFile = new File("/some path/request.txt"); requestFile.write(rawRequest); // Create the file for the response and write to it. def responseFile = new File("/some path/response.txt"); responseFile.write(rawResponse); // Note the .write() action overwrites anty pre-existing file.
Related Content
- 7 years ago
Recent Discussions
- 6 hours ago
- 17 days ago