空手道 - $ |不是字符串 (LIST:STRING) 失败

Karate - $ | not a string (LIST:STRING) failure

空手道 DSL: 我在使用正则表达式断言时遇到问题,它适用于 0.9.6 版空手道,但在 1.0.1 版(1.0.0 版)中失败。

这是来自空手道的失败消息:

And match response.data[*].rule.url contains "#regex .*https://example.com/Invalid_checksum.*"
match failed: CONTAINS
  $ | not a string (LIST:STRING)
  ["https://example.com/Identifier_unknown","https://example.com/Invalid_checksum","https://example.com/Legal_form_"]
  '#regex .*https://example.com/Invalid_checksum.*'

正如我所提到的 - 它适用于 0.9.6,因此我假设正则表达式已正确编写。自空手道 1.0.0 (?)

以来,肯定发生了一些变化

有人可以确认这是空手道错误 or/and 有任何解决方法吗?

这是一个错误,记录在这里:https://github.com/intuit/karate/issues/1568

解决方法 - 将 RHS 包装在一个数组中:

And match response.data[*].rule.url contains ["#regex .*https://example.com/Invalid_checksum.*"]

以后actually test the RC releases and provide early feedback to avoid these kinds of surprises. There's a LinkedIn group如果有需要可以加入。谢谢