pytest-dev / pytest-bdd

BDD library for the py.test runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.3k stars 219 forks source link

Step definition parses wrong parameter from feature file #670

Open NavyaAJ opened 8 months ago

NavyaAJ commented 8 months ago

Pytest BDD version : 7.0.1

I have below lines in feature file:

Given..
When..
Then I see  a <status_code_returned>
And I see a "<error_message>"

Examples:
|status_code_returned| error_message.                        |
| 409                |   credential exists                   |

Within the step definition .py file of Then, the value of status code is populating as , ' credential exists ' instead of 200, and it is throwing ValueError exception during assertion as it is expecting int (200)

I tried commenting And line in feature file and the value for _status_codereturned is passing as expected.

Update:

The issue is step definition for feature line And I see a "<error_message>" is before than the line ThenI see a <status_code_returned>. So during execution , pytest-bdd maps this line with the other as the beginning of both the feature lines are same.

This code was perfectly working in previous versions of pytest-bdd, so it will be great if a fix can be in place.