Forum Discussion
Usually compared with a static actual response, say master response or gold response (which was already verified and saved). This works well if it does not have any dynamic data such as dates, or ids etc.,
Otherwise, have to ignore certain fields while comparing.
Again there can be soap response, json response or xml response. I don't think any single general solution can be used.
Do you have any specific data that you need to compare?
This is JSON response.
I already figured out how to grab actual response (will probably pass keys as arguments to my method) - but for some reason the response appears without quotation marks, ex {key: value} but I want {"key":"value"}
def responseMess = testRunner.testCase.testSteps["testCaseName"].testRequest.response.contentAsString
def response = new JsonSlurper().parseText(responseMess)
def partialactualResponse = response.data.key1.key2.key3
I am still not sure how to grab expected response.
In my test I have failed assertion. How to grab expected response from there and pass it as an argument to my method?
Unless there is a better way of doing it ..
The screenshot above is just an example. I need to figure out how to capture response for any assertion
Related Content
- 3 years ago
Recent Discussions
- 31 minutes ago
- 16 days ago