Skip to content
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

Union of examples tables is broken #479

Closed
elchupanebrej opened this issue Jan 8, 2022 · 2 comments
Closed

Union of examples tables is broken #479

elchupanebrej opened this issue Jan 8, 2022 · 2 comments

Comments

@elchupanebrej
Copy link

elchupanebrej commented Jan 8, 2022

When I execute Feature

            Feature: Outline
                Scenario Outline: Outlined given, when, thens
                    Given there are <start> cucumbers
                    When I eat <eat> cucumbers
                    Then I should have <left> cucumbers

                    Examples:
                    | start | eat | left |
                    |  12   |  5  |  7   | # a comment

                    Examples:
                    | start | eat | left |
                    |  5    |  4  |  1   | # a comment

Two scenarios are executed (OK)

But when I execute Feature:

          Feature: Outline
                Scenario Outline: Outlined given, when, thens
                    Given there are <start> cucumbers
                    When I eat <eat> cucumbers
                    Then I should have <left> cucumbers

                    Examples:
                    | start | eat | left |
                    |  12   |  5  |  7   | # a comment

                    Examples: Vertical
                    | start | 5 |
                    | eat   | 4 |
                    | left  | 1 |

The test fails with (not OK):

___________________ ERROR collecting test_multi_outlined.py ___________________
C:\Users\bulky\Projects\pytest-bdd\pytest_bdd\parser.py:172: in parse_feature
    (scenario or feature).examples.add_example_row(param_line_parts[0], param_line_parts[1:])
C:\Users\bulky\Projects\pytest-bdd\pytest_bdd\parser.py:420: in add_example_row
    raise exceptions.ExamplesNotValidError(
E   pytest_bdd.exceptions.ExamplesNotValidError: Example rows should contain unique parameters. "start" appeared more than once

During handling of the above exception, another exception occurred:
test_multi_outlined.py:3: in <module>
    @scenario(
C:\Users\bulky\Projects\pytest-bdd\pytest_bdd\scenario.py:232: in scenario
    feature = get_feature(features_base_dir, feature_name, encoding=encoding)
C:\Users\bulky\Projects\pytest-bdd\pytest_bdd\feature.py:54: in get_feature
    feature = parse_feature(base_path, filename, encoding=encoding)
C:\Users\bulky\Projects\pytest-bdd\pytest_bdd\parser.py:175: in parse_feature
    raise exceptions.FeatureError(
E   pytest_bdd.exceptions.FeatureError: Scenario has not valid examples. Example rows should contain unique parameters. "start" appeared more than once.
E   Line number: 12.
E   Line: | start | 5 |.
E   File: outline.feature
=========================== short test summary info ===========================
ERROR test_multi_outlined.py - pytest_bdd.exceptions.FeatureError: Scenario h...
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.18s ===============================

These two cases are exactly the same but are executed differently

@elchupanebrej
Copy link
Author

elchupanebrej commented Jan 8, 2022

This fixed by #478

elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 8, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 8, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 12, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 12, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 12, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 13, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 13, 2022
@olegpidsadnyi
Copy link
Contributor

Proper support for the multiple example tables has to be implemented as separate example tables with their own tags etc.

elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 14, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 14, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 14, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 14, 2022
elchupanebrej pushed a commit to elchupanebrej/pytest-bdd-ng that referenced this issue Jan 14, 2022
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

No branches or pull requests

2 participants