want to test assertion of integer value should be >3 in Karate API

我与影子孤独终老i 提交于 2019-12-20 03:52:15

问题


json response is "Value": 0.23

i want to put assertion here value should be less than 3 so how to do this ? tried some examples in documentation but they are for array format of jsonenter code here

Scenario: Shows the minimum time any DB request to CS will take This value is an important indicator for the performance of the database access.

Given path 'admin/rest/status/db/'
When method get
Then status 200
And match response contains { Value: ">3"}
 * match Value == { '#? _ > 3' }
* match $.Value == '##[_ > 3]'
* def H = response
* print H

tried with above assertion not found any solution


回答1:


You can construct it as below:

* def resp = { "Value": 0.23 }
* match resp == { "Value": '#? _ < 3' }
* match resp.Value == '#? _ < 3'


来源:https://stackoverflow.com/questions/57375248/want-to-test-assertion-of-integer-value-should-be-3-in-karate-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!