如果我正确理解了这个问题,假设您只想为流程运行一次子流程,那么您要查找的是一张表(或一个场景概要)。
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