radish-bdd / radish

Behavior Driven Development tooling for Python. The root from red to green.
https://radish-bdd.github.io
MIT License
181 stars 49 forks source link

Can not use PIPE (|) character in Scenario Outlines #351

Closed eerkunt closed 5 years ago

eerkunt commented 5 years ago

Hello,

As also tried in https://github.com/eerkunt/terraform-compliance/issues/110, we can't use ( or escape ) PIPE | character within Scenario Outlines.

Example Feature ;

  Scenario Outline: Ensure that my specific tags are defined
    Given I have resource that supports tags defined
    When it contains tags
    Then it must contain <tag_keys>
    And its value must match the "<pattern>" regex

    Examples:
      | tag_keys        | pattern           |
      | BusinessUnit    | ^(IT\|Marketing)$ |

Stack Trace :

Error: Hook 'console_writer_after_each_scenario' from /Users/sharky/Repository/venv3/lib/python3.7/site-packages/radish/extensions/formatters/gherkin.py:425 raised: 'RadishError: Invalid colum_index to get column width for ScenarioOutline 'Ensure that my specific tags are defined''

Traceback (most recent call last):
  File "/Users/sharky/Repository/venv3/lib/python3.7/site-packages/radish/scenariooutline.py", line 126, in get_column_width
    len(self.examples_header[column_index]),
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../venv3/lib/python3.7/site-packages/radish/hookregistry.py", line 132, in call
    func(model, *args, **kwargs)
  File "/.../venv3/lib/python3.7/site-packages/radish/extensions/formatters/gherkin.py", line 467, in console_writer_after_each_scenario
    for i, x in enumerate(scenario.example.data)
  File "/...venv3/lib/python3.7/site-packages/radish/extensions/formatters/gherkin.py", line 467, in <genexpr>
    for i, x in enumerate(scenario.example.data)
  File "/.../venv3/lib/python3.7/site-packages/radish/scenariooutline.py", line 131, in get_column_width
    self.sentence
radish.exceptions.RadishError: Invalid colum_index to get column width for ScenarioOutline 'Ensure that my specific tags are defined'

It looks like some frameworks already support this, any chance we can see this support in radish-bdd ?

Thanks!

timofurrer commented 5 years ago

Seems like a bug to me. I'll have a closer look into it this evening. Thanks for reporting it :tada:

timofurrer commented 5 years ago

I've implemented a fix with f1acaec and I'll release that asap.

eerkunt commented 5 years ago

Thanks for the quick fix mate. I will update this issue after testing with the new version.

timofurrer commented 5 years ago

You are very welcome!

Can you give https://github.com/radish-bdd/radish/releases/tag/v0.13.1 a shot please :)

eerkunt commented 5 years ago

Tested with 0.13.1, confirming it is working as intended :)

Thanks for the quick fix!

timofurrer commented 5 years ago

Awesome :tada: Always a pleasure!