Forum Discussion
nmrao
9 years agoChampion Level 3
I am not well in jsonPath. But following script assertion (for the rest request step) can help you to achieve what you are looking for.
Define a test case custom property, MAX_EXPECTED_SIZE and provide value for the same and now try your case.
import net.sf.json.groovy.JsonSlurper def jsonSlurper = new JsonSlurper() def object = jsonSlurper.parseText(context.response) def expectedSize = context.testCase.getPropertyValue('MAX_EXPECTED_SIZE') as int assert object.matchingAddresses.addressList.size() < expectedSize, "Address List size is less than expected size"
- sayee9 years agoNew Contributor
Hi Rao,
Thanks for your response.
I have tried using "for existence with script" option to write the script to validate using Soap UI NG Pro but it has throwed me an error
"Not Implemented for JSON!"
Thanks
Sayee
- TanyaYatskovska9 years agoSmartBear Alumni (Retired)
Hi Sayee,
Please take a look at the following thread. It contains several script samples that work with the number of the JSON objects: