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

Scenario Outline Examples do not work with Table parameters #389

Open
pahniki opened this issue Nov 11, 2019 · 4 comments
Open

Scenario Outline Examples do not work with Table parameters #389

pahniki opened this issue Nov 11, 2019 · 4 comments

Comments

@pahniki
Copy link

pahniki commented Nov 11, 2019

Hello.
I'm trying to get into Radish and found unexpected for me behavior.

I have a scenario with test parameterization via Scenario Outline, like this one:

Feature: Whatever.

  Scenario Outline: Test radish parametrization
    Then Print <num1> and <num2>
      | a      | b      |
      | <num1> | <num2> |

    Examples:
      | num1 | num2 |
      | 1        | 2        |
      | 3        | 4        |

And this step:

@step("Print {num1:d} and {num2:d}")
def print_num(step, num1, num2):
    logger.info("Line params: {} {}".format(num1, num2))
    logger.info("Table params: {}".format(step.table))

But for some reason values inside of the table are not replaced by values inside of Examples.
Output I received:

Line params: 1 2
Table params: [{u'a': u'<num1>', u'b': u'<num2>'}]
Line params: 3 4
Table params: [{u'a': u'<num1>', u'b': u'<num2>'}]

From my point of view that's a bug. Could you please provide some information about it? And is there any work around?

@timofurrer
Copy link
Member

Thanks for the submission!
It's indeed something that's not supported as of today.
I'll have a look at a possible implementation in master.

I'm not entirely sure about it, though.
Would you expect it also to work in a Step Text ? Like:

Scenario Outline: ...
    When some step
        """
        some <var> bla
        """

Examples:
     | var |
     | 1    |

@pahniki
Copy link
Author

pahniki commented Nov 12, 2019

Thank you for the answer.

I'll have a look at a possible implementation in master.

That would make my life a bit easier.=)

Would you expect it also to work in a Step Text ?

Well I could see it being useful. I've tried this approach yesterday too.
That's what I've got with the next code:

Feature: Whatever.

  Scenario Outline: Test radish parametrization
    When Print
      """
      <num1>
      """

    Examples:
      | num1 |
      | 1    |
      | 3    |
@step("Print {num1}")
def print_num(step, num1):
    logger.info("Line params: {}".format(num1))

Result:

Error: Cannot find step definition for step 'When Print' in Features/parametrization2.feature:11

Best regards

@timofurrer
Copy link
Member

Yeah, well that's not how Step Doc Strings, work (sorry, I was referring to it as text which is wrong) ...

You don't have to match the Doc String in the Step Pattern

@github-actions
Copy link

This Issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Assigned for Issues or PRs which have been inactive for at least 60 days label May 10, 2020
@timofurrer timofurrer removed the stale Assigned for Issues or PRs which have been inactive for at least 60 days label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants