Skip to content

Commit 4602314

Browse files
committed
Add test
1 parent 5d17d8c commit 4602314

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/feature/test_scenario.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,33 @@ def _():
286286
]
287287

288288

289+
def test_step_parser_argument_not_in_function_signature_does_not_fail(pytester):
290+
"""Test that if the step parser defines an argument, but step function does not accept it,
291+
then it does not fail and the params is just not filled."""
292+
293+
pytester.makefile(
294+
".feature",
295+
simple="""
296+
Feature: Simple feature
297+
Scenario: Step with missing argument
298+
Given a user with username "user1"
299+
""",
300+
)
301+
pytester.makepyfile(
302+
"""
303+
from pytest_bdd import scenarios, given, parsers
304+
305+
scenarios("simple.feature")
306+
307+
@given(parsers.parse('a user with username "{username}"'))
308+
def create_user():
309+
pass
310+
"""
311+
)
312+
result = pytester.runpytest()
313+
result.assert_outcomes(passed=1)
314+
315+
289316
def test_multilanguage_support(pytester):
290317
"""Test multilanguage support."""
291318
pytester.makefile(

0 commit comments

Comments
 (0)