在场景之后是否有相当于 运行 步骤的背景部分?

Is there an equivalent to the Background section to run steps after scenarios?

在小黄瓜中编写黄瓜测试时,可以定义一系列步骤,这些步骤将在每个场景之前执行

我找不到与 运行 一系列步骤 在每个 场景之后的等效项。

我的用例是:

Background:
  - login
  - go to products page
  - select product

Scenario Outline:
  - Configure product in different ways

  Examples:
    | options |
    | values  |

After Each:
  - go to checkout
  - fill in personal data
  - fill in payment data
  - submit

是否有我在文档中遗漏的等效选项?

设计后没有等效项。 Cucumber 中每个场景的重点是推动 When 指定的特定行为的发展。由于新行为主要建立在现有行为的基础上,因此预计许多场景将具有共同的背景。例如,如果您正在编写有关登录网站的场景(良好登录、错误密码、忘记密码......),您的用户将必须注册。

场景中的Then是断言When有效。之后的任何事情都应该在不同的场景中。

所以你的例子可以是

Given a product is configured with ...
When I buy the product
Then ...

所有之后的内容都移到了之前的内容中,可能还有时间。