空手道:我想断言要匹配部分回应 [英] Karate: I would like to assert to match parts of response
本文介绍了空手道:我想断言要匹配部分回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
空手道:我想断言要匹配部分回应
Karate: I would like to assert to match parts of response
我收到以下答复: 12:10:33.960 [打印] Kyc状态从未开始"更改为接受".原因:输出地址AddressLine:6927 14TH AVE
I am getting the following response: 12:10:33.960 [print] Kyc Status changed from NotStarted to Accepted.Reason: Output Address AddressLine : 6927 14TH AVE
但是我只想断言来匹配部分响应. 例如:"Kyc状态从未开始"更改为已接受".
But I would like to only make assertion to match part of the response. e.g.: "Kyc Status changed from NotStarted to Accepted."
推荐答案
以下示例应解决您的问题:
The following examples should solve your problem:
Scenario: Matching text
* def yourResponse = "12:10:33.960 [print] Kyc Status changed from NotStarted to Accepted.Reason: Output Address AddressLine : 6927 14TH AVE"
* match yourResponse contains "NotStarted to Accepted"
* match yourResponse !contains "does not contain"
* assert new RegExp("NotStarted to Accepted").test(yourResponse)
不用说,您可以在assert new RegExp
构造中使用任何正则表达式.
Needless to say, that you can use any regex with the assert new RegExp
construct.
这篇关于空手道:我想断言要匹配部分回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文