在 Specflow 中跨多个场景大纲共享一组通用示例多个、示例、大纲、场景

2023-09-07 23:57:02 作者:小妞,来给爷笑个

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

Is is possible to share a common set of examples across multiple scenario outlines in Specflow without duplicating the set of examples for each outline?

例如请原谅点头示例,但这里 Examples 为每个 Scenario Outline 重复,我想知道是否可以声明这些 Examples 一次并且将它们用于每个Scenario Outline?

e.g. excuse the noddy example, but here the Examples are repeated for each Scenario Outline and I want to know if it's possible to declare those Examples once and use them for each 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 |

推荐答案

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

It appears this is not actually possible in SpecFlow.