是否可以在Behat(小黄瓜)
中嵌套场景轮廓e.g。对于不同的一组示例,请执行以下所有操作
Scenario Outline: Some Outline
Given step one with <var1>
When step two with <var2>
Then step three
Examples:
| var1 | var2 |
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
答案 0 :(得分:1)
你的意思并不完全清楚。你写的场景大纲看起来很好。它最终会做到以下几点:
Given step one with 1
When step two with 4
Then step three
Given step one with 2
When step two with 5
Then step three
Given step one with 3
Then step two with 6
Then step three
但听起来好像你想做更多这样的事情:
Given step one with 1
And step one with 2
And step one with 3
Then step two with 4
And step two with 5
And step two with 6
Then step three
这是inline tables发挥作用的地方。你会这样做:
Scenario: Some Scenario
Given step one
| var |
| 1 |
| 2 |
| 3 |
When step two
| var |
| 4 |
| 5 |
| 6 |
Then step three
您需要编写&#34;第一步&#34;和&#34;第二步&#34;上下文文件中的步骤接受单个TableNode
参数并使用foreach(){}
进行迭代。