You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem
Currently, keywords Given, When, Then are just aliases for the same function. The keyword is not taken into account when searching for step definition by step text. Some users would like to enable strict matching and avoid ambiguity in feature files.
A solution
Provide an option to enable strict keywords matching. When enabled, the following code will throw an error.
Step definition:
Given(“Ihave{number}dollars”,()=>{ ... })
Feature:
Scenario: a scenarioGiven I have 100 dollars
When I win in a lottery
Then I have 200 dollars # <- will throw an error, b/c step is defined with Given
There were several discussions in Cucumber community. In general, many people voted for such option.
The problem
Currently, keywords
Given
,When
,Then
are just aliases for the same function. The keyword is not taken into account when searching for step definition by step text. Some users would like to enable strict matching and avoid ambiguity in feature files.A solution
Provide an option to enable strict keywords matching. When enabled, the following code will throw an error.
Step definition:
Feature:
There were several discussions in Cucumber community. In general, many people voted for such option.
Rules applied in strict mode
Given
,When
,Then
matches only definitions with the corresponding keyword or with universalStep
functionAnd
/But
looks up the nearest full keyword (Given
,When
,Then
) and then follows the rule 1And / But
, it is treated asGiven
*
matches definitions with any keywordOption name
respectKeywordDefinition: true
strictKeywords: true
matchKeywords: true
keywordsMatch: true
The text was updated successfully, but these errors were encountered: