Skip to content

Not all variants of empty examples tables are parsed in same way #480

@elchupanebrej

Description

@elchupanebrej

When I execute any of next 3 scenarios they are passing(OK)

Feature: Outline
    Scenario Outline: Outlined given, when, thens
        Given there are 12 apples
        When I eat 5 apples
        Then I should have 7 apples

        Examples:
Feature: Outline
    Scenario Outline: Outlined given, when, thens
        Given there are 12 apples
        When I eat 5 apples
        Then I should have 7 apples

        Examples: Vertical
Feature: Outline
    Scenario Outline: Outlined given, when, thens
        Given there are 12 apples
        When I eat 5 apples
        Then I should have 7 apples
        Examples:
        |

But when I execute the next scenario - it fails (not OK):

Feature: Outline
    Scenario Outline: Outlined given, when, thens
        Given there are 12 apples
        When I eat 5 apples
        Then I should have 7 apples

        Examples: Vertical
        |

with error:

__________ ERROR collecting test_multi_outlined_empty_examples_1.py ___________
test_multi_outlined_empty_examples_1.py:4: 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:172: in parse_feature
    (scenario or feature).examples.add_example_row(param_line_parts[0], param_line_parts[1:])
E   IndexError: list index out of range
=========================== short test summary info ===========================
ERROR test_multi_outlined_empty_examples_1.py - IndexError: list index out of...
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.17s ===============================

Pay attention that the next variant is used by Cucumber.io by default for empty tables

        Examples:
        |

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