Hey rao
that's perfect fella - exactly what I need! :)
I was trying to expand the snippet a little - as I have a property created in the request via the VersionNumber QueryParameter that is available via ('${REST Request#VersionNumber}') - I was trying to edit the snippet - changing the script from
assert context.response, 'Response is empty or null'
def json = new groovy.json.JsonSlurper().parseText(context.response)
assert json.data.VersionNumber.every{1 == it}
to
assert context.response, 'Response is empty or null'
def json = new groovy.json.JsonSlurper().parseText(context.response)
assert json.data.VersionNumber.every{context.expand ('${REST Request#VersionNumber}') == it}
I tried variations of this and I've done a bit of reading about the 'it' and 'every' groovy functions - but I can't quite tweak the script assertion so it's successful - the assertion always fails
I was wondering about the datatype - and I think I've noticed beforehand that the context.expand treats properties as string rather than numerics, so I tried adding the .toInteger() method at the end of the parameterization as follows:
assert context.response, 'Response is empty or null'
def json = new groovy.json.JsonSlurper().parseText(context.response)
//assert json.data.VersionNumber.every{1== it}
assert json.data.VersionNumber.every{context.expand('${REST Request#VersionNumber}').toInteger() == it}
and it worked! :)
Hahahaha! very excited I managed to do this without someone giving me the answer! :):):):):):)
Thanks to all, and special thanks to rao - yet again for saving my life
nice one,
richie