Cucumber 在特征文件中指定数字
这个问题听起来可能是新手。但在这里,我每次尝试在我的cucumber功能文件中编写iphone5时,它都会将5参数化。我不希望这种情况发生,希望它只是把iphone5当作一个字符串 导致此问题的要素文件中的行是: 然后上传iPhone5图像“xxxx.png” 然后获得以下步骤定义:Cucumber 在特征文件中指定数字,cucumber,cucumber-jvm,Cucumber,Cucumber Jvm,这个问题听起来可能是新手。但在这里,我每次尝试在我的cucumber功能文件中编写iphone5时,它都会将5参数化。我不希望这种情况发生,希望它只是把iphone5当作一个字符串 导致此问题的要素文件中的行是: 然后上传iPhone5图像“xxxx.png” 然后获得以下步骤定义: @And("^then upload iPhone(\\d+) image \"([^\"]*)\"$") public void then_upload_iPhone_image(int arg1, String
@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();
}
只需删除数字的正则表达式,并从方法中删除参数
@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();
}