Forum Discussion
StevenColon
7 years agoSmartBear Alumni (Retired)
Thank you for posting to our Community Forum.
You can pull the request information in the script assertion, modify it with groovy string manipulation, and assert it against the response. Here is a sample script based on the sample :
def request = context.expand( '${REST Request#Request}' ) //Cut Start of Response certStart = "------BeginCertificate ------" certStartLength= certStart.length()+1 trimmedRequest = request.substring(certStartLength) //cut end of response certEnd="------EndCertificate----" certEndIndex = trimmedRequest.indexOf(certEnd) trimmedRequest = trimmedRequest.substring(0, certEndIndex) //need to define response assert response == trimmedRequest
Here is some documentation for you to explore:
- Script Assertion: https://support.smartbear.com/readyapi/docs/testing/assertions/reference/script.html
- Get Data Functionality (Used to select Request content): https://support.smartbear.com/readyapi/docs/testing/properties/get-data.html
Have a great day!
Related Content
- 2 months agoStoplight
- 3 years agoyaminySharma04
- 10 months agoKimdoengart