Javascript 参数化黄瓜中的特征

Javascript 参数化黄瓜中的特征,javascript,cucumber,gherkin,Javascript,Cucumber,Gherkin,在我使用javascript的测试套件中,我对每个场景大纲使用相同的参数集: Feature: Select a Product Install Checklist for Product Scenario Outline: functionA() is called on page type <type> -- No errors Given I load the site and go to a <type> page Then I shou

在我使用javascript的测试套件中,我对每个场景大纲使用相同的参数集:

Feature: Select a Product
  Install Checklist for Product

  Scenario Outline: functionA() is called on page type <type> -- No errors
    Given I load the site and go to a <type> page
    Then I should see no errors are thrown

    Examples:
      | type |
      | "product" |
      | "home" |
      | "collection" |

  Scenario Outline: functionA() is called on page type <type> -- Minimal delay
    Given I load the site and go to a <type> page
    Then there is a minimal delay before calling functionA()

    Examples:
      | type |
      | "product" |
      | "home" |
      | "collection" |

  Scenario Outline: functionA() is called -- correct type <type>
    Given I load the site and go to a <type> page
    Then the page type is <type>

    Examples:
      | type |
      | "product" |
      | "home" |
      | "collection" |

  ...many more tests using an identical Examples array


编辑:对于将来关注这一点的人,我在这里打开了一个相关的问题:

您可以尝试使用插件,通过使用数据提供程序可以重用示例。这是小黄瓜的延伸,我担心你试图解决错误的问题。想想你的场景描述了什么。阅读Cucumber的创建者Aslak Hellesøy的这篇博客文章,你试图实现的并不是Cucumber设计用来解决的问题。我已经看到了这一点,但我不明白为什么测试步骤级和测试用例级参数化被认为是Cucumber设计用来解决的问题,但升级到测试套件突然成了Cucumber无法解决的问题。你能告诉我吗?为什么这不是一个受支持的使用Can的理由是,如果你使用cucumber作为脚本工具,并且据我所知,这是你使用的,那么你最好使用一个合适的脚本/测试工具。在Java世界中,这将是像JUnit这样的工具。Cucumber和BDD的目的是能够记录对问题的共同理解。因此,底层实现是无趣的。文档恰好非常适合执行。文档、共享知识和沟通是Cucumber的目标。不是测试。测试是一个很好的副作用,但仅此而已。这就是Cucumber不支持测试参数化的原因。如果你允许人们滥用工具,他们会的。因此,如果需要的话,最好阻止他们,并将他们指向其他方向。这正是我正在寻找的东西。如果它可以用于javascript,那就太神奇了。你知道使用javascript的替代方案吗?不,这个插件只支持Cucumber Java,我不确定类似的插件是否可以用于javascript。
Feature Outline: Select a Product
  Install Checklist for Product

  Scenario Outline: functionA() is called on page type <type> -- No errors
    Given I load the site and go to a <type> page
    Then I should see no errors are thrown

  Scenario Outline: functionA() is called on page type <type> -- Minimal delay
    Given I load the site and go to a <type> page
    Then there is a minimal delay before calling functionA()

  Scenario Outline: functionA() is called -- correct type <type>
    Given I load the site and go to a <type> page
    Then the page type is <type>

  ...many more tests using an identical Examples array

  Examples:
    | type |
    | "product" |
    | "home" |
    | "collection" |

Feature: Select a Product
  Install Checklist for Product

  Rule Outline: verify functionA() on page type <type>

    Scenario Outline: functionA() is called on page type <type> -- No errors
      Given I load the site and go to a <type> page
      Then I should see no errors are thrown

    Scenario Outline: functionA() is called on page type <type> -- Minimal delay
      Given I load the site and go to a <type> page
      Then there is a minimal delay before calling functionA()

    Scenario Outline: functionA() is called -- correct type <type>
      Given I load the site and go to a <type> page
      Then the page type is <type>

  ...many more tests using an identical Examples array

    Examples:
      | type |
      | "product" |
      | "home" |
      | "collection" |