Debian Codegraph @

features/directory_layout.advanced.feature

raw
1 Feature: Advanced, more complex directory layout (Variant 2)
2
3 As a story/test writer
4 I want a deeper, more structured directory structure when many feature files exist
5 So that I have the parts better under control (more managable)
6
7 . ADVANCED, MORE COMPLEX DIRECTORY LAYOUT STRUCTURE:
8 . features/
9 . +-- group1.features/
10 . | +-- *.feature
11 . +-- group2.features/
12 . | +-- *.feature
13 . +-- steps/*.py # Step definitions or step-library imports.
14 . +-- environment.py # OPTIONAL: environment setup/hooks.
15 .
16 . SEE ALSO:
17 . * http://pythonhosted.org/behave/gherkin.html#layout-variations
18 .
19 . RELATED:
20 . * issue #99: Layout variation "a directory containing your feature files" ...
21
22 @setup
23 Scenario: Setup directory structure
24 Given a new working directory
25 And a file named "features/steps/steps.py" with:
26 """
27 from behave import step
28
29 @step('{word:w} step passes')
30 def step_passes(context, word):
31 pass
32
33 @step('{word:w} step fails')
34 def step_fails(context, word):
35 assert False, "XFAIL-STEP"
36 """
37 And a file named "features/steps/environment_steps.py" with:
38 """
39 from behave import step
40
41 @step('environment setup was done')
42 def step_ensure_environment_setup(context):
43 assert context.setup_magic == 42
44 """
45 And a file named "features/environment.py" with:
46 """
47 def before_all(context):
48 context.setup_magic = 42
49 """
50 And a file named "features/group1/alice.feature" with:
51 """
52 Feature: Alice
53 Scenario: A1
54 Given a step passes
55 When another step passes
56 Then a step passes
57
58 Scenario: A2
59 Then environment setup was done
60 """
61 And a file named "features/group1/bob.feature" with:
62 """
63 Feature: Bob
64 Scenario: B1
65 When a step passes
66 Then another step passes
67 """
68 And a file named "features/group2/charly.feature" with:
69 """
70 Feature: Charly
71 Scenario: C1
72 Given another step passes
73 Then a step passes
74 """
75
76
77 Scenario: Run behave with feature directory
78 When I run "behave -f progress features/"
79 Then it should pass with:
80 """
81 3 features passed, 0 failed, 0 skipped
82 4 scenarios passed, 0 failed, 0 skipped
83 8 steps passed, 0 failed, 0 skipped, 0 undefined
84 """
85
86 Scenario: Run behave with feature subdirectory (CASE 1)
87 When I run "behave -f progress features/group1/"
88 Then it should pass with:
89 """
90 2 features passed, 0 failed, 0 skipped
91 3 scenarios passed, 0 failed, 0 skipped
92 6 steps passed, 0 failed, 0 skipped, 0 undefined
93 """
94
95 Scenario: Run behave with feature subdirectory (CASE 2)
96 When I run "behave -f progress features/group2/"
97 Then it should pass with:
98 """
99 1 feature passed, 0 failed, 0 skipped
100 1 scenario passed, 0 failed, 0 skipped
101 2 steps passed, 0 failed, 0 skipped, 0 undefined
102 """
103
104 Scenario: Run behave with one feature file
105 When I run "behave -f progress features/group1/alice.feature"
106 Then it should pass with:
107 """
108 1 feature passed, 0 failed, 0 skipped
109 2 scenarios passed, 0 failed, 0 skipped
110 4 steps passed, 0 failed, 0 skipped, 0 undefined
111 """
112 When I run "behave -f progress features/group2/charly.feature"
113 Then it should pass with:
114 """
115 1 feature passed, 0 failed, 0 skipped
116 1 scenario passed, 0 failed, 0 skipped
117 2 steps passed, 0 failed, 0 skipped, 0 undefined
118 """
119
120
121 Scenario: Run behave with two feature files (CASE 1)
122 Given a file named "one.featureset" with:
123 """
124 features/group1/alice.feature
125 features/group2/charly.feature
126 """
127 When I run "behave -f progress @one.featureset"
128 Then it should pass with:
129 """
130 2 features passed, 0 failed, 0 skipped
131 3 scenarios passed, 0 failed, 0 skipped
132 6 steps passed, 0 failed, 0 skipped, 0 undefined
133 """
134
135 Scenario: Run behave with two feature files (CASE 2: different ordering)
136 Given a file named "two.featureset" with:
137 """
138 features/group2/charly.feature
139 features/group1/alice.feature
140 """
141 When I run "behave -f progress @two.featureset"
142 Then it should pass with:
143 """
144 2 features passed, 0 failed, 0 skipped
145 3 scenarios passed, 0 failed, 0 skipped
146 6 steps passed, 0 failed, 0 skipped, 0 undefined
147 """