Forum Discussion
nmrao
10 years agoCommunity Hero
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"