错误“实际值不是字符串".在空手道中执行断言时 [英] Error "actual value is not a string" while performing assertion in Karate

查看:35
本文介绍了错误“实际值不是字符串".在空手道中执行断言时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际值不是字符串错误

执行断言时出错

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

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

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

Error- assertion failed: path: $, actual: [1850, 700, 30], expected: '["1850.0","30.0","700.0"]', reason: actual value is not a string

推荐答案

是的,因为它不是.这将起作用:

Yes, because it is not a string. This will work:

* 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

Please see this other answer also: https://stackoverflow.com/a/57761131/143475

这篇关于错误“实际值不是字符串".在空手道中执行断言时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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