Skip to content

Add descriptions support for the nodes: ExampleTable, Outline and Sce…#254

Closed
jojo1981 wants to merge 2 commits intoBehat:masterfrom
jojo1981:feature/descriptions
Closed

Add descriptions support for the nodes: ExampleTable, Outline and Sce…#254
jojo1981 wants to merge 2 commits intoBehat:masterfrom
jojo1981:feature/descriptions

Conversation

@jojo1981
Copy link

Now the descriptions.feature sample in CompatibilityTest will work.
The code is backward compatible.

@ciaranmcnulty
Copy link
Contributor

This looks great! How does it change the output of the pretty printer in Behat, though? As long as it's just that the descriptions are cleanly omitted I think that's fine?

@@ -437,6 +438,7 @@ protected function parseOutline()
$token = $this->expectTokenType('Outline');

$title = trim($token['value'] ?? '');
Copy link
Member

Choose a reason for hiding this comment

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

why removing the trimming for scenario but not for outline ?

Copy link
Author

Choose a reason for hiding this comment

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

I thought to make it compatible with the CompatibilityTest for the descriptions.feature.
I now see this is NOT the case. I will fix this.

Copy link
Author

Choose a reason for hiding this comment

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

Reverted the trim scenario title functionality.

@stof
Copy link
Member

stof commented Sep 13, 2022

This might impact the pretty printer ignoring description because previously, that description would be parsed as a multi-line title (and so displayed).
However, adding the rendering of the description in Behat should be easy.

@jojo1981
Copy link
Author

I didn't check that, but as this change is not backwards compatible based on functionality a new major version should be released including this feature.
The Behat library can be made compatible later and use the new major version of this library.

@acoulton
Copy link
Contributor

@jojo1981 thanks very much for this contribution and I'm sorry it was stalled for so long.

We're working on introducing this behaviour through an opt-in GherkinCompatibilityMode feature flag in the parser, which will allow us to handle a number of edge cases and enhancements without a breaking Gherkin release. We've also identified some other cases where the detail of what is / is not valid as part of a description doesn't match our current behaviour.

Because of that, and because there have been quite a few changes in the project since you opened this, I've started a new implementation in #361 rather than building on the commits you already have here.

Therefore I'm going to close this PR, but it's been helpful to read through your code as a starting point and I will be sure to credit your contribution in the upcoming release.

Thanks!

@acoulton acoulton closed this May 26, 2025
acoulton added a commit that referenced this pull request Nov 24, 2025
Historically, we have not supported parsing descriptions as a separate
concept for Examples, Background, Scenario or Scenario Outline. Text
following the keyword line was instead parsed as a multi-line title.

This PR implements support for instead capturing these as standalone
properties when running in cucumber/gherkin compatibility mode.

This borrowed from and builds on work done by @jojo1981 in #254, 
but started from a clean branch as there have been a lot of changes
since that PR was opened.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants