Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gherkin 6(JavaScript): differientiate between scenario and scenario outline #627

Closed
xgbuils opened this issue Jun 4, 2019 · 3 comments
Closed
Labels
library: gherkin ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support

Comments

@xgbuils
Copy link

xgbuils commented Jun 4, 2019

Given a feature with a scenario:

Feature: feature name
Scenario:

And other with a scenario outline:

Feature: feature name
Scenario Outline:

There is not an easy way to differentiate if the parsed scenario is outline or not.

Scenario:

FeatureChild {
   scenario: 
    Scenario {
      tags: [],
      steps: [],
      examples: [],
      location: Location { line: 2, column: 1 },
      keyword: 'Scenario' } }

Scenario Outline:

FeatureChild {
   scenario: 
    Scenario {
      tags: [],
      steps: [],
      examples: [],
      location: Location { line: 2, column: 1 },
      keyword: 'Scenario Outline' } }

Motivation:

Differentiating between scenario types is necessary for gherkin-lint which applies rules over scenario outlines (no-scenario-outlines-without-examples rule) that are not applicable over simple scenarios.

Possible Solution

As you can see, we can differentiate scenario types using keyword property. However, the keyword depends on the used language and we can't rely on that. gherkin@5 also exports a DIALECTS object that could be useful for get the scenario type based on scenario keyword. But I don't think it's the best solution.

Could it be possible adding a type prop in scenarios for differentiating between scenario types?

Environment

  • Version used: gherkin@6 vs gherkin@5
  • Operating System and version: Linux 64-bit - Ubuntu 18.04
@xgbuils
Copy link
Author

xgbuils commented Jun 23, 2019

Any update about it?

@aslakhellesoy aslakhellesoy added language: javascript library: gherkin ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support and removed language: javascript labels Jun 27, 2019
@aslakhellesoy
Copy link
Contributor

As of Gherkin v6, Scenario and Scenario Outline are synonyms. They have the same AST type. The way we determine whether or not a scenario is an "outline" is to see whether or not it has Examples underneath. For example, the pickles compiler uses this strategy when it compiles the AST to pickles.

With this design, the no-scenario-outlines-without-examples rule is obsolete.

See the 6.0.13 CHANGELOG

@xgbuils
Copy link
Author

xgbuils commented Jun 27, 2019

Thanks @aslakhellesoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library: gherkin ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support
Projects
None yet
Development

No branches or pull requests

2 participants