方案与方案概述
背景:
我目前正在为Symfony2网页编写behat测试(Mink/ Selenium)。我有很多例子可以参考,实际上写它们应该没有问题。步骤定义已编写完毕。
但是,在示例中,它们有时定义 a,有时定义 aScenario:
Scenario Outline:
问题:
这两种定义测试的方式有什么区别?
背景:
我目前正在为Symfony2网页编写behat测试(Mink/ Selenium)。我有很多例子可以参考,实际上写它们应该没有问题。步骤定义已编写完毕。
但是,在示例中,它们有时定义 a,有时定义 aScenario:
Scenario Outline:
问题:
这两种定义测试的方式有什么区别?
来自官方指南:
复制和粘贴方案以使用不同的值可能会很快变得乏味和重复:
Scenario: Eat 5 out of 12 Given there are 12 cucumbers When I eat 5 cucumbers Then I should have 7 cucumbers Scenario: Eat 5 out of 20 Given there are 20 cucumbers When I eat 5 cucumbers Then I should have 15 cucumbers
场景大纲允许我们通过使用带有占位符的模板来更简洁地表达这些示例
Scenario Outline: Eating Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 | | 20 | 5 | 15 |
“方案大纲”步骤提供了一个从不直接运行的模板。方案大纲对其下方的“示例”部分中的每一行运行一次(第一个标题行除外)。
更多内容请参阅写作功能指南。