首页 > 解决方案 > 黄瓜标签链接

问题描述

我在考虑链接标签

来自https://cucumber.io/docs/cucumber/api/的基本示例

@billing
Feature: Verify billing

  @important
  Scenario: Missing product description
    Given hello

  Scenario: Several products
    Given hello

我想做的是

@billing
Feature: Verify billing

  @important
  Scenario: Missing product description
    Given hello

  Scenario: Several products
    Given hello please run @important tag 

@important 的所有步骤都会执行,这可能吗?我在谷歌没有找到任何例子:(如果是的话你能帮我找一些材料吗?

堆栈:带有cypress-cucumber-preprocessor 的JS https://github.com/TheBrainFamily/cypress-cucumber-preprocessor 我还查看了所有示例,没有看到类似的东西

谢谢您的帮助 :)

标签: testingcucumbere2e-testinggherkin

解决方案


听起来您是在说您希望能够在另一个场景中重用现有场景中的步骤,对吗?

我不会尝试在 Gherkin 级别组织重用(这不是一种编程语言,而是一种规范语言),而是在您的步骤定义中的代码中降低级别。

帮助您组织步骤定义代码的一个非常好的模式是剧本模式,它允许您创建可重用的自动化代码的可组合“块”。

这是我写的关于该模式的博客文章:https ://cucumber.io/blog/bdd/understanding-screenplay-(part-1)/


推荐阅读