黄瓜 - 生成错误的缺失步骤

cucumber - generating wrong missing steps

我在我的自动化代码中使用了 Cucumber 和 TestNG

.特征文件

Scenario Outline: Enter valid Location Setup 
    When : I enter the Restaurant ID as “<setup_RestaurantID>“ 
    Examples: 
        | setup_StoreID | setup_RestaurantID | 
        | test          | 1234               |

当我 运行 自动化脚本时它正在生成打击缺少步骤

@When("^: I enter the Restaurant ID as “(\d+)“$")
public void i_enter_the_Restaurant_ID_as(int arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

但是 cucumber 应该如下生成缺少的步骤

@When("^: I enter the Restaurant ID as \"([^\"]*)\"$")
public void i_enter_the_Restaurant_ID_as(String arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

其他设置:

单色 = 真

Maven 依赖项:

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
</dependency>

<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>5.2.1</version>
</dependency>

你能帮我解决一下吗?提前致谢。

答案:将引号(“)替换为参数的双引号(”)。

花了几个小时后观察到参数用双引号而不是双引号包围。实际上我已经收到 BA 的功能文件,他使用 apple notes(启用了智能引号)编写了 .feature 文件,将双引号转换为引号。

When : I enter the Restaurant ID as "<setup_RestaurantID>"