Solved
Forum Discussion
richie
Community Hero
OH!
Sorry fella - I thought the script asserted that the response was returned in a certain order - as you can see - there's plenty of the script I can't actually read - I didnt realise the script was actually doing the sorting!
Apologies - that's not what I'm after.
I have a requirement where I'm requesting the data back in either ascending or descending order relative to the queryparm I'm specifying (e.g. /api/1/{namespace}/{table}?_sort=tableAttribute desc)
I thought your script actually ASSERTED the response was in ascending order as this is what I need to verify,
my bad!
richie
nmrao
6 years agoChampion Level 3
More over, it was not even reading your data at all, forget about sort order. Because that was tailored for original question.
- richie6 years agoCommunity HeroHahaha!
What a dunce.....what can i say? I'm definitely making progress with my groovy, but it's very slow going!
But actually it's a lot more elegant than using the otb functionality....totally changed my opinion....im trying to do everything with groovy now! ;)
Nice one!
richie- nmrao6 years agoChampion Level 3
richie ,
Does the below helps?
//Define the ordered list which is in the same order of the values as expected def expectedList = [] def response = context.expand( '${REST Request#Response}' ) def json = new groovy.json.JsonSlurper().parseText(response) assert expectedList == json.data.Name
- richie6 years agoCommunity Hero
hahahaha!
Perfect!
thanks man!
richie
Related Content
- 5 years agoVitamin