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

Update to Gherkin 3 #43

Open
hsudbrock opened this issue Jul 9, 2015 · 8 comments
Open

Update to Gherkin 3 #43

hsudbrock opened this issue Jul 9, 2015 · 8 comments

Comments

@hsudbrock
Copy link

hsudbrock commented Jul 9, 2015

In the following example, I get java hyperlinks for the second line in the scenario outline, but not for the first. It seems to be caused by using '*' and not one of the keywords 'And', 'Given', etc.

Feature: Checkout

    Scenario Outline: Checkout a banana
        * the price of a "banana" is 40c
        And the price of a "pear" is 60 c
        When I checkout <count> "banana"
        And I checkout 1 "banana"
        And I checkout 2 "pear"
        Then the total price should be <total>c

        Examples:
        | count | total |
        | 1     | 200   |
        | 2     | 240   |
        | 3     | 280   |

missing-java-link

@rlogiacco
Copy link
Owner

Your interpretation is correct, actually the line starting with the asterisk is not interpreted as a step but it is rather considered part of the scenario outline description. I wasn't aware the asterisk can be used to identify a step: can you point me to the documentation regarding this?

@hsudbrock
Copy link
Author

Interesting - Cucumber happily executes my Gherkin features that contain the asterisk, but I cannnot find it documented in the Cucumber documentation.

I know the asterisk-feature from this book: https://pragprog.com/book/srjcuc/the-cucumber-for-java-book. The asterisk-feature is also described in blog entries on Cucumber (e.g., http://antonymarcano.com/blog/tag/gherkin/).

Nevertheless, the asterisk-feature is not documented in the attempt to define a BNF grammar for Gherkin (https://github.com/cucumber/gherkin/wiki/BNF).

I will try to find out where these asterisks are handled in Cucumber's Gherkin parser...

@rlogiacco
Copy link
Owner

Sadly the Natural plugin doesn't use the Gherkin parser, but one I've described myself in an EBNF like syntax. If you wish I'm still strugglying to find a way to use the official parser and get rid of the many parsing issues we are experiencing.

Would you be willing to help me on this?

@hsudbrock
Copy link
Author

In the Gherkin3 parser project the asterisk is defined in the language definition file (https://github.com/cucumber/gherkin3/blob/master/gherkin-languages.json), where the asterisk is just one of potentially multiple "translations" for keywords like "when", "given", etc. It seems odd to me defining the asterisk as a translation, but the Gherkin3-people will have had a good reason for that, I guess.

Yes, I would be willing to help, but cannot say yet when I will find time for this. I'll keep in touch.

@rlogiacco rlogiacco changed the title Hyperlink to Java issues not enabled when using '*' instead of 'Given' Update to Gherkin 3 Mar 22, 2016
@drkstr101
Copy link
Contributor

drkstr101 commented May 8, 2020

Updated URL: https://github.com/cucumber/cucumber/blob/master/gherkin/gherkin-languages.json

This will most likely need to be included in a general "localization" update. The issue is in fact that newer versions of Gherkin will match practically any starting word as a keyword. I have even seen joke implementations written in Klingon. We will probably need to update the AST to use any keyword as the starting word, or just ignore it altogether and consume the whole line of text as the step. This would actually solve another problem I'm running into with the code generator, which is the lack of support in the AST to access the keyword, preventing serialization until an update can be made. It will also make step matching a bit more expensive, but this can be mitigated in other ways.

@drkstr101
Copy link
Contributor

drkstr101 commented May 30, 2020

@rlogiacco Confirmed partial fix in next. * is now a supported Step keyword. There have also been other minor improvements on the localization front, but nothing to fruition yet.

@github-actions
Copy link

github-actions bot commented Aug 4, 2020

This issue has not been updated for a while: marking it as stale.

@github-actions github-actions bot added the Stale Probably not relevant anymore and to be closed label Aug 4, 2020
@rlogiacco rlogiacco removed the Stale Probably not relevant anymore and to be closed label Aug 11, 2020
@rlogiacco rlogiacco reopened this Aug 11, 2020
@drkstr101
Copy link
Contributor

@rlogiacco This will be closed by #86

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

No branches or pull requests

3 participants