空手道:我想断言要匹配部分回应
我收到以下答复: 12:10:33.960 [打印] Kyc状态从“未开始”更改为“接受”。原因:输出地址AddressLine:6927 14TH AVE
但是我只想断言来匹配部分响应。 例如:“ Kyc状态从“未开始”更改为“已接受”。
答案 0 :(得分:1)
以下示例可以解决您的问题:
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
构造一起使用。