-
Notifications
You must be signed in to change notification settings - Fork 226
Free vars in steps examples #439
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
Free vars in steps examples #439
Conversation
Codecov Report
@@ Coverage Diff @@
## master #439 +/- ##
==========================================
+ Coverage 95.93% 96.13% +0.19%
==========================================
Files 50 50
Lines 1649 1732 +83
Branches 179 182 +3
==========================================
+ Hits 1582 1665 +83
Misses 41 41
Partials 26 26
Continue to review full report at Codecov.
|
5cbcaf2
to
b5bda8a
Compare
@olegpidsadnyi @hicksjduk please review the approach to work with free variables in parameters or examples; I've saved behavior to work with parameterized tests from pytest side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one comment about terminology.
b5bda8a
to
6e4d4c6
Compare
As for the options it would be annoying to specify this on each scenario. It is easier to turn this option off in the .ini file once and for all. See https://docs.pytest.org/en/6.2.x/writing_plugins.html#using-hooks-in-pytest-addoption - there should be something about pytest plugin options. |
Thanks! Hadn't take this into view |
Thanks guys, excellent ideas.
…On 18 August 2021 15:21:59 BST, Kostiantyn Goloveshko ***@***.***> wrote:
> As for the options it would be annoying to specify this on each scenario. It is easier to turn this option off in the .ini file once and for all. See https://docs.pytest.org/en/6.2.x/writing_plugins.html#using-hooks-in-pytest-addoption - there should be something about pytest plugin options.
Thanks! Hadn't take this into view
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#439 (comment)
|
Changed validation of a scenario against its examples table so that the list of parameters defined for the scenario does not have to be the same as the list of parameters defined in the examples table, but can be a subset. This allows columns to be specified in the examples table that are not used in the scenario, but are there for future use or purely for documentation purposes.
5eaa909
to
d628253
Compare
b96ad4e
to
ef31daa
Compare
for more information, see https://pre-commit.ci
Added options to control such behavior from ini files |
@elchupanebrej The paradigm has changed based on our latest discussion. The unification of the
I'm not sure if Step.params is any useful anymore. |
During the implementation of #478 I've reviewed this approach and found that in case if we have outlined scenarios we could use extra columns for joining example tables as part of a primary key. To make this feature unambiguous I propose that both joinable tables have to include such key. In another case just skip parameters set as ambiguous Also, I found that sometimes impossible to combine Example tables if they are unbalanced by parameter count so some parameters could be unfilled. In such case, I propose to not render parameters. This case could be intercepted by a specific step definition For tag columns I propose to use "@" sign to mark the column as a tag column, so: Feature: Outline
Examples:
| fruits | @ | @ | key | # | status |
| apples | red | fresh | 1 | # | ill |
| oranges | green | rotten | 2 | # | hungry |
Examples:
| fruits | # | status |
| peaches | # | full |
Scenario Outline: Outlined given, when, thens
Given there are <start> <fruits>
When I eat <eat> <fruits>
Then I should have <left> <fruits>
# And I am <status>
Examples:
| start | eat | left | key |
| 12 | 5 | 7 | 2 |
| 5 | 4 | 1 | 1 |
Examples:
| start | eat | left |
| 16 | 9 | 7 |
| 8 | 3 | 5 |
| 9 | 7 | 2 | So in this example will be executed: "status" column is just commented but still there |
Where this syntax is coming from? Gherkin is a cucumber standard. It is supported by multiple editors. Pytest-bdd is supported by PyCharm. Is it something that people can reason about? I don't really want to introduce a new language here. |
If we want to remove the restriction that the variables in the example table should match the steps we should focus only on that. |
I can't find any recommendations on the official gherkin reference how to treat the unused table variables. |
This address #390 (merged and updated #391 )