我们如何让黄瓜识别场景大纲参数后的“:”符号?

How can we have cucumber recognise a ":" symbol after a scenario outline parameter?

使用CucumberJVM编写特征文件时,传入场景大纲示例中的变量时table,我无法获得识别后跟“:”的变量的步骤。

步骤定义:

 @Given("^the following (.*) (.*): (.*)$")

成功检测到:

Given the following standard user: <username>

没有检测到:

Given the following standard <account-type>: <username>

我想要两全其美,但是当从这个例子中传递一个变量时table,黄瓜无法识别该步骤。

Examples: | username | account-type | | Jason | user | | Martin | manager |

如何在这两种情况下检测到“:”符号并在功能文件中工作?是一个 ENUM,在这种情况下 cucumber 似乎无法转换它

按照评论中的建议,修改步骤定义中的模式class。

@Given("^the following standard (.*?): (.*?)$")
public void the_following_standard_user( AccountType usertype,String user) {
    System.out.println(user);
    System.out.println(usertype);
}

AccountType是枚举。

public enum AccountType {

    USER("user"), MANAGER("manager");

    private final String type;
    private AccountType(String type) {
        this.type = type;
    }
}