gpt4 book ai didi

Karate - 有没有办法将字符串与字符串列表相匹配?

转载 作者:行者123 更新时间:2023-12-04 15:51:19 24 4
gpt4 key购买 nike

响应:

{
name : 'Sourabh'
}

实现验证:

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

上述验证失败,我如何匹配一个值(它将是值列表中的任何元素)

最佳答案

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

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

关于 Karate - 有没有办法将字符串与字符串列表相匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53737483/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com