黄瓜检测到许多参数

Cucumber detects to many arguments

我想在我的黄瓜步骤中检测名为 AppAAppBAppC 的应用列表。

"Given there are 2 badges in the repository owned by AppA,AppB"

我已经尝试了以下方法,它根据 IntelliJ 着色语法工作:

@Given("^there are (\d+) badges in the repository owned by (App[ABC](,App[ABC])*)$")

但是在编译时出现如下错误

However, the gherkin step has 3 arguments [2, AppA,AppB, ,AppB].

我认为这是正则表达式括号内的括号引起的。有没有人可以与我分享一个解决方法,所以我只得到 [2, AppA,AppB] ?

我使用非捕获组解决了这个问题?:

@Given("^there are (\d+) badges in the repository owned by (App[ABC](?:,App[ABC])*)$")

似乎 cucumber 获取了捕获组中的所有内容,即使它们是嵌套的(即使某些正则表达式检查工具只检测到列表中的 1 个)