用于检查数组中是否存在值的空手道表达式

Karate expression to check if value exists in array

这是我的样本特征文件:

Feature: Karate expression to check if status within array of status.

  Scenario: Test
    * def status = "ACTIVE"
    * def possibleStatus = ["ACTIVE", "INACTIVE"]
    * match status contains possibleStatus ?

有没有一种方法可以使用空手道表达式检查状态是 ACTIVE 还是 INACTIVE?

NOTE: 写自定义JS函数肯定可以实现。

这很简单。

* def status = "ACTIVE"
* def possibleStatus = ["ACTIVE", "INACTIVE"]
* match possibleStatus contains status

任何问题:)