Java - 黄瓜
我是新手编写黄瓜测试,获取给定方法签名的错误可以帮助一些人吗?
以下是我的功能文件条目
@txn
Feature: ORP
Scenario Outline: Save a ORP
Given when i pass start date <start date> and end date <end date>
When the user saves a ORP
Then the PROP is saved
Examples:
| start date | end date |
| 1-1-2016 | 1-1-2017 |
和步骤文件作为以下签名以获得给定的开始和结束日期
@Given ("^when i pass start date (.+) and end date (.+)$")
public void processOPR(String, start, String end){...}
当我运行测试时,我收到以下错误
Exception
@Given("^when i pass start date (\\d+)-(\\d+)-(\\d+) and end date (\\d+)-(\\d+)-(\\d+)$")
public void when_i_pass_start_date_and_end_date(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
我想在一个变量中传递日期“1/1/2016”而不是3个不同的变量。
答案 0 :(得分:0)
找到解决方案如下
@Given ("^when i pass start date (.+) and end date (.+)$")
public void processOPR(@Format("dd-MM-yyyy")Date start, @Format("dd-MM-yyyy") Date end){...}