在黄瓜特征文件中指定数字

时间:2014-01-28 11:58:51

标签: cucumber cucumber-jvm

问题听起来可能是新手。但在这里,我每次尝试在我的黄瓜功能文件中编写iphone5时参数设置为5.我不希望这种情况发生,并希望它只是将iphone5视为一个字符串。

我的功能文件中的行导致此问题: 然后上传iPhone5图片“xxxx.png”

然后得到以下步骤定义:

@And("^then upload iPhone(\\d+) image \"([^\"]*)\"$")
public void then_upload_iPhone_image(int arg1, String arg2) throws Throwable {
    // Express the Regexp above with the code you wish you had
    throw new PendingException();
}

1 个答案:

答案 0 :(得分:1)

只需删除数字的正则表达式,然后从方法中删除参数。

@Given("^I upload to iphone5$")
public void I_upload_to_iphone() throws Throwable {
    // Express the Regexp above with the code you wish you had
    throw new PendingException();
}

在你的情况下

@And("^then upload iPhone5 image \"([^\"]*)\"$")
public void then_upload_iPhone_image(String arg2) throws Throwable {
    // Express the Regexp above with the code you wish you had
    throw new PendingException();
}