How Use Pipe Character Inside Examples Table Of Behave Test .feature File?
I have a Behave Scenario outline where I need to use pipe character - | as a cell value inside Examples table. But I don't know how to escape this character to not be treated as co
Solution 1:
As far as I can tell, it is not possible to escape cell delimiters as of version 1.2.5 (current at the time of posting). The relevant code is in the action_table
method. This is how it splits a line into cells:
cells = [cell.strip() for cell in line.split('|')[1:-1]]
I searched before and after this line but did not see code that would transform sequences like \|
or anything similar into something that .split('|')
would not affect.
The only solution I see, as of 1.2.5, would be to hand-code the content of your cells so that you use another character than |
in the cell data and then convert it to |
in your Python code. For instance, using !
, you could have in the feature file:
| foo!bar |
and then convert !
to |
in your step implementations. This is awful but I don't see another way to get what you want.
Post a Comment for "How Use Pipe Character Inside Examples Table Of Behave Test .feature File?"