由于我的步骤
步骤定义文件中的错误,我无法执行下面的Cucumber方案"User Selects <Origin>, <Destination>, <Date> and <MonthYear>".
Date和MonthYear的正则表达式存在一些问题。我添加了我的Cucumber Scenario和我的步骤定义的片段
Cucumber Feature:
Scenario Outline: User Searches One Way Flight
Given User is logged into the application
When User selects One way trip
And User Selects <Origin>, <Destination>, <Date> and <MonthYear>
Then Search results should be displayed.
Examples:
| Origin | Destination | Date | MonthYear |
| New York | Sydney | 20 | January 2016 |
步骤定义
@When("^User Selects \"([^\"]*)\", \"([^\"]*)\", \"(\\d+)\" and \"([\\d+]*)\"$")
public void user_selects(String origin, String destination, String date, String monthYear) {
flight.searchOneWayFlight(origin, destination, date, monthYear);
}
答案 0 :(得分:1)
您需要使用int
作为日期,而monthYear中的正则表达式不会传递月份部分。
@Given("^User Selects (.*?), (.*?), (\\d+) and (.*?)$")
public void userSelects(String origin, String destination, int date, String monthYear)