这是一个关于 Cucumber 的棘手问题:
Feature: Some feature
Background:
Given I am on the root page
Scenario Outline: Relevant flash messages should appear
When I fill in some_field with: <name>
Then I should see the text: <relevant_flash>
Examples:
| name | relevant_flash |
| Some name | Some message |
Scenario Outline: Irrelevant flash messages should not appear
When I fill in some_field with: <name>
Then I should not see the text: <irrelevant_flash>
Examples:
| name | irrelevant_flash |
| Some name | Some message |
我讨厌不得不重复:
When I fill in some_field with: <name>
但由于显而易见的原因,它不能仅仅移动到背景中。或者可以吗?如果您有解决方法,请告诉我...