字符串不支持的匹配类型:CONTAINS_ANY

时间:2019-05-28 05:03:28

标签: karate

我想验证字符串数组中所有项目的值匹配

response.data[0].attributes.status,其中包含任何["active","deleted" ,"deleting","processing"]

1 个答案:

答案 0 :(得分:0)

请阅读karate documentation about the contains any matcher

contains any期望右侧和左侧是json数组或json对象的类型。

一个带有json数组的简单示例:

 * match  ['active', 'deleted'] contains any ['status', 'active']

与json对象相同:

 * match  {'foo':'bar'} contains any {'foo':'bar', 'mr':'pink'}

您的问题:
您想匹配自己的状态为["active","deleted" ,"deleting","processing"]之一。换句话说,["active","deleted" ,"deleting","processing"]包含状态。

空手道说话:

 * match ["active","deleted" ,"deleting","processing"] contains response.data[0].attributes.status