Debian Codegraph @

features/formatter.tags_location.feature

raw
1 @sequential
2 Feature: TagsLocation Formatter
3
4 As a tester
5 I want to know where and in which context tags are used
6 So that I better understand how to use tags in feature files and on command-line
7
8 NOTE: Primarily intended for dry-run mode.
9
10
11 @setup
12 Scenario: Feature Setup
13 Given a new working directory
14 And a file named "features/steps/steps.py" with:
15 """
16 from behave import step
17
18 @step('a step passes')
19 def step_passes(context):
20 pass
21 """
22 And a file named "features/alice.feature" with:
23 """
24 @one
25 Feature: Alice
26
27 @setup
28 Scenario: Setup Feature
29 Given a step passes
30
31 @wip
32 Scenario: A1 with tags: @wip (inherited: @one)
33 Given a step passes
34
35 @foo
36 @wip
37 Scenario: A2 with tags: @foo, @wip (inherited: @one)
38 When a step passes
39
40 @foo @bar
41 Scenario: A3 with tags: @foo, @bar (inherited: @one)
42 Then a step passes
43 """
44 And a file named "features/bob.feature" with:
45 """
46 @two
47 Feature: Bob
48
49 Scenario: B1 without tags (inherited: @two)
50 Given a step passes
51
52 @foo @one
53 Scenario: B2 with tags: @foo, @one (inherited: @two)
54 When a step passes
55 """
56
57
58 Scenario: Use TagsLocation formatter to get an overview where tags are used
59 When I run "behave -f tags.location --dry-run features/"
60 Then it should pass with:
61 """
62 0 features passed, 0 failed, 0 skipped, 2 untested
63 0 scenarios passed, 0 failed, 0 skipped, 6 untested
64 """
65 And the command output should contain:
66 """
67 TAG LOCATIONS (alphabetically ordered):
68 @bar:
69 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
70
71 @foo:
72 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
73 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
74 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
75
76 @one:
77 features/alice.feature:2 Feature: Alice
78 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
79
80 @setup:
81 features/alice.feature:5 Scenario: Setup Feature
82
83 @two:
84 features/bob.feature:2 Feature: Bob
85
86 @wip:
87 features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one)
88 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
89 """
90 But note that "tags inherited from its feature are (normally) not counted."
91
92
93 Scenario: Use TagsLocation formatter together with another formatter
94 When I run "behave -f tags.location -f plain -T features/"
95 Then it should pass with:
96 """
97 2 features passed, 0 failed, 0 skipped
98 6 scenarios passed, 0 failed, 0 skipped
99 """
100 And the command output should contain:
101 """
102 Feature: Alice
103
104 Scenario: Setup Feature
105 Given a step passes ... passed
106
107 Scenario: A1 with tags: @wip (inherited: @one)
108 Given a step passes ... passed
109
110 Scenario: A2 with tags: @foo, @wip (inherited: @one)
111 When a step passes ... passed
112
113 Scenario: A3 with tags: @foo, @bar (inherited: @one)
114 Then a step passes ... passed
115
116 Feature: Bob
117
118 Scenario: B1 without tags (inherited: @two)
119 Given a step passes ... passed
120
121 Scenario: B2 with tags: @foo, @one (inherited: @two)
122 When a step passes ... passed
123 """
124 And the command output should contain:
125 """
126 TAG LOCATIONS (alphabetically ordered):
127 @bar:
128 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
129
130 @foo:
131 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
132 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
133 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
134
135 @one:
136 features/alice.feature:2 Feature: Alice
137 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
138
139 @setup:
140 features/alice.feature:5 Scenario: Setup Feature
141
142 @two:
143 features/bob.feature:2 Feature: Bob
144
145 @wip:
146 features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one)
147 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
148 """
149
150
151 Scenario: Use TagsLocation formatter when tags are selected
152 When I run "behave -f tags.location --tags=@setup,@wip features/"
153 Then it should pass with:
154 """
155 1 feature passed, 0 failed, 1 skipped
156 3 scenarios passed, 0 failed, 3 skipped
157 """
158 And the command output should contain:
159 """
160 TAG LOCATIONS (alphabetically ordered):
161 @bar:
162 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
163
164 @foo:
165 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
166 features/alice.feature:18 Scenario: A3 with tags: @foo, @bar (inherited: @one)
167 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
168
169 @one:
170 features/alice.feature:2 Feature: Alice
171 features/bob.feature:8 Scenario: B2 with tags: @foo, @one (inherited: @two)
172
173 @setup:
174 features/alice.feature:5 Scenario: Setup Feature
175
176 @two:
177 features/bob.feature:2 Feature: Bob
178
179 @wip:
180 features/alice.feature:9 Scenario: A1 with tags: @wip (inherited: @one)
181 features/alice.feature:14 Scenario: A2 with tags: @foo, @wip (inherited: @one)
182 """
183 And note that "all tags are detected even from skipped features and scenarios"