想要测试整数值的断言应该在空手道 API 中大于 3空手道、断言、整数、测试

2023-09-08 00:08:30 作者:少女的猪

json 响应为值":0.23

json response is "Value": 0.23

我想在这里断言值应该小于 3 那么怎么做呢?在文档中尝试了一些示例,但它们是针对此处的 jsonenter 代码的数组格式

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

场景:显示对 CS 的任何 DB 请求将花费的最短时间 该值是数据库访问性能的重要指标.

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

推荐答案

可以如下构造:

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