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

问题描述 投票:0回答:1

我在自动化代码中使用黄瓜和TestNG

。feature文件

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>

您能帮我修复它吗?预先感谢。

java cucumber testng
1个回答
0
投票
答案:用双引号(“)代替参数的引号()。

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

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

© www.soinside.com 2019 - 2024. All rights reserved.