Is there an easy way to break up a response object into parts like http code, headers, body etc and then extract values from each of these parts? I prefer not to use long and ugly xml like Test#ResponseAsXml/Some long ugly path.
Re: Is there an easy way to access parts of an API response in a groovy script?
@aaronpliu - Thanks for your reply. Some questions.
def teststep = testRunner.testCase.testSteps['Your Test Step']
def responseStatus = teststep.testRequest.response.responseHeaders["#status#"]
1) Could you please point me to the official documentation on these classes and functions like testRunner etc.? 2) Is there a table of keywords to use for other headers besides "#status#"? 3) Like the headers, can I easily access body also, maybe like this -
teststep.testRequest.response.body(Json path query to get a field)