Skip to content

Commit b3956b3

Browse files
authored
Merge pull request #709 from jsa34/scenario-outline-with-slashes
2 parents 86f4ee1 + aecff18 commit b3956b3

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Unreleased
1111
- Use `gherkin-official` parser to replace custom parsing logic. This will make pytest-bdd more compatible with the Gherkin specification.
1212
- Multiline steps must now always use triple-quotes for the additional lines.
1313
- All feature files must now use the keyword `Feature:` to be considered valid.
14-
- Tags can no longer have spaces (e.g. "@tag one" "@tag two" are no longer valid).
14+
- Tags can no longer have spaces (e.g. "@tag one" and "@tag two" are no longer valid).
1515
- Tags can now be on multiple lines (stacked)
1616

1717
7.3.0

tests/feature/test_outline.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,50 @@ def _(string):
219219
r"bork \\",
220220
r"bork \\|",
221221
]
222+
223+
224+
def test_forward_slash_in_params(pytester):
225+
"""Test parametrised scenario when the parameter contains a slash, such in a URL."""
226+
227+
pytester.makefile(
228+
".feature",
229+
outline=textwrap.dedent(
230+
"""\
231+
Feature: Outline
232+
Scenario Outline: Outlined with slashes
233+
Given I am in <Country>
234+
Then I visit <Site>
235+
236+
Examples:
237+
| Country | Site |
238+
| US | https://my-site.com |
239+
240+
"""
241+
),
242+
)
243+
pytester.makeconftest(textwrap.dedent(STEPS))
244+
245+
pytester.makepyfile(
246+
textwrap.dedent(
247+
"""\
248+
from pytest_bdd import given, parsers, scenarios, then
249+
from pytest_bdd.utils import dump_obj
250+
251+
scenarios('outline.feature')
252+
253+
254+
@given(parsers.parse("I am in {country}"))
255+
def _(country):
256+
pass
257+
258+
259+
@then(parsers.parse("I visit {site}"))
260+
def _(site):
261+
dump_obj(site)
262+
263+
"""
264+
)
265+
)
266+
result = pytester.runpytest("-s")
267+
result.assert_outcomes(passed=1)
268+
assert collect_dumped_objects(result) == ["https://my-site.com"]

0 commit comments

Comments
 (0)