Karate 空手道API测试-API响应数组的数值验证
我的一个空手道变量holdingid中存储了一个响应:Karate 空手道API测试-API响应数组的数值验证,karate,Karate,我的一个空手道变量holdingid中存储了一个响应: And def holdingID = $GetDataSet_greaterThan_Filter_Response.rowData[*].7 霍丁基德= [ 21015000, 146066000, 10497015000, 58765000, 27790000, 4.308709302E7, 2.0360701868295E7, 21710000, 331720000, 62327000, 57210000, 19430000,
And def holdingID = $GetDataSet_greaterThan_Filter_Response.rowData[*].7
霍丁基德=
[
21015000,
146066000,
10497015000,
58765000,
27790000,
4.308709302E7,
2.0360701868295E7,
21710000,
331720000,
62327000,
57210000,
19430000,
19129000,
2.0168081879E8,
35242933,
7.0444591772E8,
2.551241528E7,
1.948655045E7,
2.520400137E7,
3.8540777658E8,
103001450,
1.957371122E7,
1.680594819E8,
20907400,
19500118,
1.8480989443E8,
181875000,
5.609840033E7,
6.931536767E7,
5.32741731109984E8,
188974032,
591381346,
8.419481045E7,
19868866,
5.5488624902E7,
30759197,
8.926510191E7,
5.382712107E7,
3.095059546E7,
7.174669486E7,
23828000,
42558698,
1.7776693E7,
21695100,
7.198816072E8,
322132495,
19120000
]
现在,我需要使用某个值(例如:17559097)检查以下对此的操作:
And def listAsDescending = new ArrayList()
* eval for(var i = 0; i < holdingID.length; i++) listAsDescending.add(holdingID[i])
And print listAsDescending
* eval Collections.sort(listAsDescending)
和def listAsDescending=new ArrayList()
*(变量i=0;i
但我得到了以下错误:Collections.sort(listAsDescending),java.lang.Integer不能转换为java.lang.Long
如何对存储的变量执行这些操作?仔细阅读文档,有很多方法。我让你去寻找其他方法:
* def holdingId = [ 21015000, 146066000, 10497015000, 58765000, 27790000, 4.308709302E7, 2.0360701868295E7, 21710000, 331720000, 62327000, 57210000, 19430000, 19129000, 2.0168081879E8, 35242933, 7.0444591772E8, 2.551241528E7, 1.948655045E7, 2.520400137E7, 3.8540777658E8, 103001450, 1.957371122E7, 1.6805940819E8, 20907400, 19500118, 1.8480989443E8, 181875000, 5.609840033E7, 6.931536767E7, 5.32741731109984E8, 188974032, 591381346, 8.419481045E7, 19868866, 5.5488624902E7, 30759197, 8.926510191E7, 5.382712107E7, 3.095059546E7, 7.174669486E7, 23828000, 42558698, 1.777676693E7, 21695100, 7.198816072E8, 322132495, 19120000 ]
* match each holdingId == '#? _ > 17559097'
* def fun = function(x){ return x > 17559097 }
* def actual = karate.filter(holdingId, fun)
* match holdingId == actual