如何忽略cucumber中相同值的stepdefinition变量声明

如何忽略cucumber中相同值的stepdefinition变量声明,cucumber,cucumber-jvm,cucumberjs,cucumber-java,cucumber-junit,Cucumber,Cucumber Jvm,Cucumberjs,Cucumber Java,Cucumber Junit,对于相同的值,如何忽略cucmber中的StepDefinition变量声明 因此,假设我有如下示例: Scenario Outline: Looking up the definition of fruits Given the user is on the Wikionary home page When the user <name> looks up the definition of the word <name> Then they s

对于相同的值,如何忽略cucmber中的StepDefinition变量声明

因此,假设我有如下示例:

Scenario Outline: Looking up the definition of fruits
    Given the user is on the Wikionary home page
    When the user <name> looks up the definition of the word <name>
    Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
    Examples:
    | name |
    | pear |
现在,在上面的步骤中,我创建了两个不必要的变量,我这样做是因为我的cucumber报告应该在when语句中的两个位置获得名称。
如果我只输入一个变量,cucumber将抛出一个错误


如果您需要任何进一步的信息或我遗漏了什么,请告诉我。

使用regex中的非捕获组-
(?:.*)
。方法中只需要一个参数


将正则表达式中的非捕获组-(?:.*)用于任何组。方法中只需要一个参数。谢谢@Grasshopper-你总是帮助我们。。。我一定会试试这个,很快会给你回复。。此外,你可以分享任何链接,从那里我可以得到所有这些关于黄瓜regrex的信息是的,蚱蜢,它工作得很好。。您可以将此添加为答案。。。请在回答时也分享链接。。这会有很大帮助:)
@When("^the user (.*?) looks up the definition of the word (.*?)$")
public void when(String name, String name2){
  System.out.println(name);
  System.out.println(name2);
}