【发布时间】:2017-06-28 05:27:42
【问题描述】:
我有一个功能文件如下:
Scenario Outline: Create ABC
Given I open the application
When I enter username as <username>
And I enter password as <password>
Then I enter title as <title>
And press submit
Examples:
| username | password | title |
| Rob | xyz1 | title1 |
| Bob | xyz1 | title2 |
这要求我对这些值中的每一个都有步骤定义。我可以换一个
可以为每个用户名或密码或标题值映射的通用步骤定义
示例部分。
也就是说,而不是说
@When("^I enter username as Rob$")
public void I_enter_username_as_Rob() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
我可以进入吗
@When("^I enter username as <username>$")
public void I_enter_username_as_username(<something to use the value passed>) throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
【问题讨论】:
-
怎么会这样?一定是老黄瓜插件,现在的outline已经很好支持了,在
的情况下只产生一个通用的step函数。无需更改为“” -
当通过 JUnit 执行时仍然会在 CucumberJVM 1.2.5 上发生。所以使用引号。 :-)
标签: cucumber cucumber-jvm