Error “actual value is not a string” while performing assertion in Karate

血红的双手。 提交于 2020-01-05 07:55:27

问题


actual value is not a string error

Getting an error while performing an assertion

field1 = [1850, 700, 30] field2 = ["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


回答1:


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

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



来源:https://stackoverflow.com/questions/57780903/error-actual-value-is-not-a-string-while-performing-assertion-in-karate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!