cancel
Showing results for 
Search instead for 
Did you mean: 

How to say set accept any value greater than Zero

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
Community Hero

Re: How to say set accept any value greater than Zero

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

 

Contributor

Re: How to say set accept any value greater than Zero

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

 




New Here?
Join us and watch the welcome video:
Final Interview in the Series
API_testing_mistake#7
Top Kudoed Authors
Top Kudoed Posts