在空手道中执行断言时出现错误“实际值不是字符串”

时间:2019-09-04 02:54:34

标签: karate

实际值不是字符串错误

执行断言时出错

field1 = [1850,700,30] field2 = [“ 1850.0”,“ 30.0”,“ 700.0”]

错误声明失败:路径:$,实际值:[1850,700,30],预期值:'[“ 1850.0”,“ 30.0”,“ 700.0”]',原因:实际值不是字符串

1 个答案:

答案 0 :(得分:0)

是的,因为它不是字符串。这将起作用:

* def field1 = [1850, 700, 30]
* def field2 = ["1850.0","30.0","700.0"]
* def field3 = karate.map(field2, function(x){ return ~~x })
* match field1 contains only field3

也请参见以下其他答案:https://stackoverflow.com/a/57761131/143475