Forum Discussion
JHunt
Community Hero
You could use this as a Script Assertion:
String unsorted = new groovy.json.JsonSlurper().parseText(messageExchange.responseContent)
."result" .with { groovy.json.JsonOutput.toJson( it ) } String sorted = new groovy.json.JsonSlurper().parseText(messageExchange.responseContent)
."result"
.sort { -it."rating" } .with { groovy.json.JsonOutput.toJson( it ) } assert sorted == unsorted
chathurad
7 years agoContributor
Thanks for the quick responce , Let me try this.
- JHunt7 years agoCommunity HeroHi, did you get a notification for my edit? Should be messageExchange.responseContent instead of messageExchange.response.
- chathurad7 years agoContributor
No signature of method: groovy.json.JsonSlurper.parseText() is applicable for argument types: (com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse) values: [com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse@13ad1457] Possible solutions: parseText(java.lang.String), parse(java.io.Reader)
I tryed to execute your code But.
Im getting this error. Any idea?
This is the exact API.
https://a31k83hfp9.execute-api.us-east-1.amazonaws.com/dev/schools?filterParams=default
- JHunt7 years agoCommunity Hero
Hi,
It just looks like you didn't put in the correction I mentioned in my second post above.
Attached is a project with a working example.
Related Content
- 4 years ago
Recent Discussions
- 15 years ago