我有一個特性文件,該文件是如下:黃瓜場景輪廓和示例與通用的步驟定義
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();
}
怎麼能這樣呢?它必須是一些舊的黃瓜插件,現在輪廓得到很好的支持,並且只在的情況下產生一個單一的通用步進功能。無需更改爲「」 –
user1559625
當通過JUnit執行時,仍然在CucumberJVM 1.2.5上發生。所以用引號。 :-) –