pytest-dev / pytest-dev/pytest-bdd
Step definition parses wrong parameter from feature file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 251
- Avg merge
- 43m
- Merged PRs (30d)
- 2
Description
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_code_returned is passing as expected.
Update:
The issue is step definition for feature line And I see a "<error_message>" is before than the line Then I 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the feature-file example with the two similarly prefixed Then and And steps, then inspect the corresponding step-definition .py file and how pytest-bdd maps matching steps. Done means status_code_returned receives the numeric example value independently of error_message and the assertion no longer raises ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100