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 parser (JS)] Narrative support before Background steps #390

Closed
andieri opened this Issue May 20, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@andieri

andieri commented May 20, 2018

Hello!

Thanks for that work, what you do. It's awesome. I like this tool.

My Environment

  • Version used: 4.1.3
  • Operating System and version: Windows 10/7 x64, Jenkins
  • Work with: CucumberJS 2.2.0+

Summary

I have a problem. I would like to write feature files which contain the narrative description of the feature.
I can do this when I don't use Background step. But when I use Background I get parse error message,

Context & Motivation

For documentation, I would like to see the requirement of my system which is tested.

Current Behavior

Feature: Example Product - Add an item

  Narrative:

  Meta:
   @review

  Background:
    Given the system login page is open
    And logged in user testUser_2

The Gherkin parser says:

[Unhandled rejection CompositeParserException: Parser errors:
(8:3): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Background:'
(9:5): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Given the system login page is open'
(10:5): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'And logged in user testUser_2'

The same feature file with commented Narrative and Meta section can start the running with CucumberJS.

Another file which has Narrative and Meta section and doesn't have Background step can start the running with CucumberJS.

Expected Behavior

A feature file with Narrative, Meta and Background steps section can compile and run with CucumberJS.

@aslakhellesoy

This comment has been minimized.

Show comment
Hide comment
@aslakhellesoy

aslakhellesoy May 20, 2018

Contributor

The Narrative: and Meta: lines are not recognised by Cucumber as keywords, so they just become part of the Feature’s description.

Then, the @review line is recognised as a tag. According to the Gherkin grammar, the next keyword following a tag must be Feature, Scenario, Scenario Outline or Examples - or another tag. You cannot have a tag before a Background.

Contributor

aslakhellesoy commented May 20, 2018

The Narrative: and Meta: lines are not recognised by Cucumber as keywords, so they just become part of the Feature’s description.

Then, the @review line is recognised as a tag. According to the Gherkin grammar, the next keyword following a tag must be Feature, Scenario, Scenario Outline or Examples - or another tag. You cannot have a tag before a Background.

@andieri

This comment has been minimized.

Show comment
Hide comment
@andieri

andieri May 21, 2018

Thanks for the clarifying.

andieri commented May 21, 2018

Thanks for the clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment