Ask a Question

How to say set accept any value greater than Zero

chathurad
Contributor

How to say set accept any value greater than Zero

As on the image i can do an assertion for the node $.result and now its value is 4.

But is there any way where i can set this assertion to accept any value greater than Zero.

 

Eg: if the node $.result is having 6 then my currant assertion will get fail because its looking for 4.

 

Hope you can understand. Thanks.

 

2 REPLIES 2
JHunt
Community Hero

Hi,

I don't know if that's possible with JsonPath Match assertion (I haven't used it much), but here's how you can do it with a Script assertion:

def result = new groovy.json.JsonSlurper().parseText(context.response).'result'
assert result > 0

 

oops, This is not possible with the given UI,

To perform you suggestion i have to use script assertion.`


@JHunt wrote:

Hi,

I don't know if that's possible with JsonPath Match assertion (I haven't used it much), but here's how you can do it with a Script assertion:

def result = new groovy.json.JsonSlurper().parseText(context.response).'result'
assert result > 0

 




cancel
Showing results for 
Search instead for 
Did you mean: