按行号范围运行黄瓜方案大纲

时间:2015-07-14 14:38:03

标签: cucumber

我知道可以在黄瓜中运行具体的例子

cucumber tests/features/my.feature:141 #just example 141
cucumber tests/features/my.feature:141:151 #just examples 141 & 151

从141到151运行一系列示例的语法是什么?

cucumber tests/features/my.feature:141-151 #this does not work

如果有帮助,这里是Scenario Outline片段......假设' tc-44'在文件

的第141行
Scenario Outline: running scenario subset of examples 
Given we are testing a subset
 And it is a scenario outline with many examples
Then we can run a subset by providing a range
Examples:
| test-case |
| tc-44 |
| tc-45 |
| tc-46 |
| tc-47 |
| tc-48 |
| tc-49 |
...
| tc-100 |

1 个答案:

答案 0 :(得分:1)

从命令行,您可以使用行号之间的冒号从同一个功能文件运行特定方案,如下所示:

cucumber tests/features/my.feature:37:52

如果在第37和52行定义了场景,则两者都将由黄瓜执行。

您也可以通过引用其行号来运行特定示例。在你的情况下,这将工作:

cucumber tests/features/my.feature:141:142:143:144:145:146:147:148:149:150:151

Cucumber将执行每个行号找到的示例。