我想在我的黄瓜步骤中检测到名为AppA
,AppB
和AppC
的应用程序列表。
即"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]
吗?
答案 0 :(得分:0)
我使用非捕获组?:
@Given("^there are (\\d+) badges in the repository owned by (App[ABC](?:,App[ABC])*)$")
黄瓜似乎可以捕获捕获组中的所有内容,即使它们是嵌套的(即使某些正则表达式检查器工具只为列表检测到1)