Comments (6)
I'm not privy the original reason for preventing the use of doc strings and data tables together. But looking back that decision seems to have been intentional.
For example in cucumber/cucumber-jvm#1183 I do see that the Gherkin v2.12.2 accepted the combination. Though it did cause an error in Cucumber JVM.
And looking at cucumber-attic/gherkin2#138 being able to parse any combination of docstrings and data tables (and incorrectly assign it to the wrong step) was considered a bug in Gherkin v2 in 2011 already.
I suspect the complexity of dealing with both docstring and data tables together in dynamically typed languages is was considered to be too much at the time.
@brasmusson @aslakhellesoy do you have anything to add to that?
In some cases it's really useful.
Such as?
Moreover, it works with quite a lot of cucumber-runners, JetBrains plugin also marks such syntax as valid.
Do you have a list of runners? I'm curious to see how they behave.
from docs.
In some cases it's really useful.
Such as?
Well, can't imagine all ways to use it, but even taking example from reference it can be combined. Let's take a look at:
It could be something like User sends a message to:
, where content of DocString
is a message and DataTable
is kinda "mailing list"
Or, for example, DocString
is SQL and DataTable contains sources to select.
It can be done by splitting to different steps ofc, but it would require to handle more states and preserve data for following steps.
from docs.
Moreover, it works with quite a lot of cucumber-runners, JetBrains plugin also marks such syntax as valid.
Do you have a list of runners? I'm curious to see how they behave.
I currently mostly work with rust runner (unofficial) as I mentioned above, it works like a charm to me.
It's possible to work with gherkin::Step which can have both docstring and table at the same time.
Sorry, I think "quite a lot" was too strong claim, at least for now - when I checked impls in this repo.
I canβt remember when and what kind of runner that was, but this syntax worked in another implementation (could be specific period of time?).
Therefore, perhaps I had a false feeling that this is allowed (also taking into account plugin highlighting and auto-formatting over all the time)
from docs.
Just to clarify: I'm totally ok if it's disallowed by intention.
Would be nice to consider allowing this or explicitly mention in documentation it's invalid gherkin
syntax
from docs.
It is a complicated question.
Gherkins grammar is specified in Berp. And in that grammar, doc strings and data tables are mutually exclusive:
But Berp is only used for Gherkin. So there is effectively no technical specification to violate. You could still ask the cucumber-rs team to match the behavior of the Cucumber Gherkin parser though.
As for IDEA. the Gherkin syntax is not versioned and has had some breaking changes over time. So it is not surprising their parser supports a superset of the different versions of Gherkin.
from docs.
If you want to update the docs, the sentence:
In some cases you might want to pass more data to a step than fits on a single line. For this purpose Gherkin has Doc Strings and Data Tables.
Could be rewritten to more strongly suggest they're mutually exclusive. Not too technically though, these are end user documentation, not technical specifications. Something like (though I think it is a bit repetitive, repeating the you every sentence):
In some cases you might want to pass more data to a step than fits on a single line. For this purpose you can either use Doc Strings or Data Tables.
We take pull requests for the docs at: https://github.com/cucumber/docs
If you want to send one that would be nice, if not I can move this whole issue there.
from docs.
Related Issues (20)
- Online documentation is broken and unreadable HOT 9
- Use Renovate to update versions.yaml
- Docs website formatting is broken HOT 24
- The API reference page is broken in production, half of the content missing HOT 2
- New unofficial golang implementation HOT 6
- Update direct links to docs on Cucumber website
- Move the 10-minute-tutorial(s) to source code and enable running them in a pre-built environments
- Netlify preview keeps spamming cookie warnings
- Books "Card" embed logic breaks the page HOT 1
- Python Cucumber: Is there a Behave replacement? HOT 2
- Json Cucumber mergeFeaturesWithRetest HOT 1
- Ctrl+C does not stop/kill Docker running the docs HOT 2
- Consistent and correct spelling
- How to enable test data externalization (through Excel/JSON etc.) using Cucumber Java and TestNG? HOT 1
- Can I decide whether the following steps should continue to execute based on the result of the previous step execution HOT 1
- Step of installing cucumber as dependency should be required for the 10 Minute Tutorial
- Add definition of glue to docs HOT 1
- Automate gherkin-i18n-table based on json of gherkin repo HOT 5
- Question for Background with Feature and Rule HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.