15

是否可以在 Specflow 中跨多个场景大纲共享一组通用示例,而无需为每个大纲复制一组示例?

例如,请原谅点头的例子,但这里Examples每个都重复Scenario Outline,我想知道是否可以声明Examples一次并为每个使用它们Scenario Outline

Feature: Just an example about animals

Scenario Outline:
    Given an <animal>
    When something happens 
    Then this should be the outcome

    Examples:
    | animal |
    | Dog |
    | Cat |

Scenario Outline:
    Given an <animal>
    When something different happens
    Then this other thing should be the outcome

    Examples:
    | animal |
    | Dog |
    | Cat |
4

2 回答 2

3

看来这在 SpecFlow 中实际上是不可能的。

于 2011-11-22T19:49:58.197 回答
0

我不确定 SepcFlow,但我们在 Cucumber 中完成了此操作,在此实例中共享 Given 步骤。

我希望 SpecFlow 以同样的方式工作。

于 2011-11-14T11:37:09.603 回答