如果我正確理解了這個問題,假設您只想爲流程運行一次子流程,那麼您要查找的是一張表(或一個場景概要)。
Scenario: Process
Given I start a process
When I have completed the sub process "<x>" "<y>" "<z>"
| x | y | z|
And then I complete task A
And then I complete task B
Then the process is finished
或
Scenario Outline: Process
Given I start a process
When I have completed the sub process "<x>" "<y>" "<z>"
And then I complete task A
And then I complete task B
Then the process is finished
| x | y | z|
Scenario Outline: SubProcess
Given I start a subprocess "<x>"
When I complete task C "<y>"
And then I complete task D "<z>"
Then the process is finished
Examples:
| x | y | z |
@When("^I have completed the sub process (.*) (.*) (.*)$")
public void I_have_completed_the_sub_process(String x, String y, String z) throws Throwable {
I_start_a_subprocess(x);
.....
<your code>;
}
你也可以有黃瓜列返回所有值列表
但是,如果這涉及到很多的配置數據,你可能會想讀取配置從像yaml文件這樣的數據源傳遞出來,並將密鑰傳遞給該步驟。
YAML文件:
:configuration:
:x: "val1"
:y: "val2"
:z: "val3"
而且你一步只需一個輸入
When I have completed the sub process "<configuration>"
步驟定義解析HashMap和需要傳遞值的步驟方法。
或者你可以有值作爲一個表,創建一個類配置和步驟定義將列表值輸入: https://thomassundberg.wordpress.com/2014/06/30/cucumber-data-tables/
public class Config{
private String x,
private String y,
Private String z }
public void step_definition_function(<List>Config config){}
來源
2016-10-04 17:17:01
Sid
因此子進程也是一個獨立的情況下,可以在工作的擁有?您是否可以不重複子流程步驟以及流程場景中的數據? – Grasshopper
嘿蚱蜢,是的子過程可以自己工作,但有多個任務+10等,我不想在2個地方保持。 – IanWatson