Skip to content

Commit f189ae4

Browse files
committed
Add test to use asterisks to continue step type instead of And or But
1 parent b3956b3 commit f189ae4

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/steps/test_keyword.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import textwrap
2+
3+
4+
def test_asterisk_keyword(pytester):
5+
pytester.makefile(
6+
".feature",
7+
asterisk=textwrap.dedent(
8+
"""\
9+
Feature: Step continuation
10+
Scenario: Asterisk steps
11+
Given I am out shopping
12+
* I have eggs
13+
* I have milk
14+
* I have butter
15+
When I check my list
16+
Then I don't need anything
17+
"""
18+
),
19+
)
20+
pytester.makepyfile(
21+
textwrap.dedent(
22+
"""\
23+
import pytest
24+
from pytest_bdd import given, when, then, scenario
25+
26+
@scenario("asterisk.feature", "Asterisk steps")
27+
def test_asterisk_steps():
28+
pass
29+
30+
@given("I am out shopping")
31+
def _():
32+
pass
33+
34+
35+
@given("I have eggs")
36+
def _():
37+
pass
38+
39+
40+
@given("I have milk")
41+
def _():
42+
pass
43+
44+
45+
@given("I have butter")
46+
def _():
47+
pass
48+
49+
50+
@when("I check my list")
51+
def _():
52+
pass
53+
54+
55+
@then("I don't need anything")
56+
def _():
57+
pass
58+
59+
"""
60+
)
61+
)
62+
result = pytester.runpytest()
63+
result.assert_outcomes(passed=1)

0 commit comments

Comments
 (0)