Skip to content

Union of examples tables is broken #479

@elchupanebrej

Description

@elchupanebrej

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions