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

查看:63
本文介绍了要测试空手道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所需的最短时间.该值是数据库访问性能的重要指标.

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天全站免登陆