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

时间:2020-05-28 17:26:43

标签: java cucumber testng

我在自动化代码中使用了黄瓜和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();
}

但是黄瓜应该会产生以下缺失步骤

@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();
}

其他设置:

monochrome = true

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>

您能帮我解决吗?预先感谢。

1 个答案:

答案 0 :(得分:1)

答案:用双引号(“)代替参数的反引号(”)。

花费几个小时后,观察到参数用双反逗号代替双引号引起来。实际上,我已经从BA收到了功能文件,他使用了苹果笔记(启用了智能引号)来编写.feature文件,该文件将双引号转换为反向逗号。

When : I enter the Restaurant ID as "<setup_RestaurantID>"
相关问题