想要测试整数值的断言应该在空手道 API 中大于 3 [英] want to test assertion of integer value should be >3 in Karate API
本文介绍了想要测试整数值的断言应该在空手道 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
场景:显示对 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'
这篇关于想要测试整数值的断言应该在空手道 API 中大于 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文