Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Add info about use of colons with keywords (Closes #284) #691

Merged
merged 1 commit into from
Oct 31, 2021

Conversation

mlvandijk
Copy link
Member

From #284:

** Use of colons **
From gitter: Jeff Johnson @jeffcjohnson Jan 16 20:45
When writing features, if a newbie like me puts a colon after Given, When or Then, it doesn't complain but doesn't do anything either. It took a while to figure out why my test was being ignored.
It would be helpful to clarify somewhere in the docs, possibly the Gherkin page.

Added this to the docs.

Motivation & context

Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

e.g. "Fixes #99"

Type of change

  • Refactoring/debt (improvement to code design or tooling without changing behaviour)

Note to other contributors

If your change may impact future contributors, explain it here, and remember to update README.md and CONTRIBUTING.md accordingly.

Update required of cucumber.io/docs

If the Cucumber documentation will require an update,
submit an issue or ideally a pull request to cucumber/docs and
reference it here.

e.g. "Ref: cucumber/docs/pull/#99"

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@mlvandijk mlvandijk mentioned this pull request Oct 30, 2021
@mlvandijk mlvandijk changed the title Add info about use of colons with keywords Add info about use of colons with keywords (Closes #284) Oct 30, 2021
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition!

@mlvandijk mlvandijk merged commit b97ba93 into main Oct 31, 2021
@mlvandijk mlvandijk deleted the use-of-colons branch October 31, 2021 13:05
@mlvandijk
Copy link
Member Author

Thanks as always @olleolleolle

@luke-hill
Copy link
Contributor

I think you've potentially raised quite an interesting bug. Because to my knowledge, keywords that shouldn't have a colon such as Given should raise parser errors?

cc/ @gasparnagy something to consider? If not universally done?

@gasparnagy
Copy link
Member

@luke-hill As the Gherkin keywords contain the space as well (e.g. Given ), if you use colons (Given:) it will not be recognized as a keyword as it does not contain the space. And because the line will start without a keyword in front, the parser will think that this is part of the scenario description and this is why these are "just ignored". The real solution for that would be to remove the space from the keywords (but it is not that easy, because some French keywords don't have the space...). Without I cannot think of an easy way to fix that.

@gasparnagy
Copy link
Member

@mlvandijk In the Formulation book we categorized the keywords to block keywords and step keywords, using that categorization it is easier to document whether you need a colon after or not (you need it for block keywords, but not for step keywords).

@mlvandijk
Copy link
Member Author

Thanks for clarifying that @gasparnagy - that might be a good addition as well

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

Successfully merging this pull request may close these issues.

4 participants