空手道-有没有办法将字符串与字符串列表匹配?

时间:2018-12-12 06:47:40

标签: karate

响应:

{
name : 'Sourabh'
}

实施验证:

And match $.name contains any ['Sourabh','Peter','Babu']

以上验证失败,如何匹配值(值列表中的任何元素)

1 个答案:

答案 0 :(得分:1)

必须有多种方法来验证这一点,我在给出一个工作示例。

* def response = {name : 'Sourabh'}
* def expectedList = ['Sourabh','Peter','Babu']
* match response.name == "#string? expectedList.indexOf(_) != -1"
相关问题