想要在空手道 API 中测试整数值的断言应该 >3 [英] want to test assertion of integer value should be >3 in Karate API

查看:22
本文介绍了想要在空手道 API 中测试整数值的断言应该 >3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Scenario:显示对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

推荐答案

您可以按如下方式构建:

You can construct it as below:

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

这篇关于想要在空手道 API 中测试整数值的断言应该 >3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆