如何在后台语句中使用黄瓜场景中提到的示例
How to use examples mentioned in cucumber scenario in Background statement
目的是将场景中提到的例子用在一个特性文件中的后台给定语句中。
以下是供参考的功能文件
Feature: As a user with a valid credentials i should view awards and select products for cart
Background:
Given an authenticated logged in user with valid <username> and <password>
@smoke
Scenario: Bot should display awards
When the user is checks for award section
Then User is presented with awards earned
Examples:
| username | password |
| username | password |
@smoke
Scenario: bot should select the proper product
When the user chooses product to buy
Then User is presented with cart with selected product.
Examples:
| username | password |
| username | password |
据我所知,您不能在后台使用示例中的变量。在您的示例中,如果您需要不同的登录名,则需要在您的实际场景中将其作为一个步骤。
Cucumber 不支持后台场景大纲。您需要在场景中定义它,这意味着如果您想要用户场景大纲,则不能在背景中使用该步骤。这是黄瓜团队关于此功能的更新enter link description here:
https://github.com/cucumber/common/issues/469
目的是将场景中提到的例子用在一个特性文件中的后台给定语句中。
以下是供参考的功能文件
Feature: As a user with a valid credentials i should view awards and select products for cart
Background:
Given an authenticated logged in user with valid <username> and <password>
@smoke
Scenario: Bot should display awards
When the user is checks for award section
Then User is presented with awards earned
Examples:
| username | password |
| username | password |
@smoke
Scenario: bot should select the proper product
When the user chooses product to buy
Then User is presented with cart with selected product.
Examples:
| username | password |
| username | password |
据我所知,您不能在后台使用示例中的变量。在您的示例中,如果您需要不同的登录名,则需要在您的实际场景中将其作为一个步骤。
Cucumber 不支持后台场景大纲。您需要在场景中定义它,这意味着如果您想要用户场景大纲,则不能在背景中使用该步骤。这是黄瓜团队关于此功能的更新enter link description here: https://github.com/cucumber/common/issues/469