radish
radish copied to clipboard
Scenario Outline Examples do not work with Table parameters
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?
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 |
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
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
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