cucumber / gherkin

A parser and compiler for the Gherkin language.
MIT License
160 stars 48 forks source link

Adding kind of an Example table in the Background steps #226

Closed NiPelissier closed 2 months ago

NiPelissier commented 4 months ago

🤔 What's the problem you're trying to solve?

As far as I know, it is not possible to use examples tables in background step. This feature could allow to run multiple times scenario of a feature with differents given steps.

It could be nice to be able to do something like this:

Feature: aFeature Background Given user1 is

    Examples
        |           aParam               |
        | connectedWithFirefow |
        |   connectedWithEdge  |

✨ What's your proposed solution?

⛏ Have you considered any alternatives or workarounds?

📚 Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

mpkorstanje commented 4 months ago

To help us understand this feature request a bit better, what is the underlying problemen you are trying to solve? Do you have a more comprehensive example?

Historically speaking, the general consensus has been that programming features don't belong in Gherkin. As they make the scenario much harder to understand for non-technical users.

It would for example be difficult to determine just by reading which examples are used where. Especially when an example table is used in the background in combination with with a scenario outline.

As a workaround, what usually does work is to create a list of things (e.g. users) using a data table in the given step of the background. All scenarios then use all these users.