cuke_cataloger 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,368 @@
1
+ Feature: Checking existing tags for correctness
2
+
3
+ Both the size of any non-trivial test suite and the potential for human error encourages
4
+ the ability to determine that the id tags in a test suite are correct in a programmatic fashion.
5
+ Therefore, the tool provides such a means.
6
+
7
+
8
+ Scenario: Detection of missing test ids when not present
9
+ Given the following feature file "has_untagged_tests.feature":
10
+ """
11
+ Feature:
12
+
13
+ Scenario:
14
+ * a step
15
+ """
16
+ And a tag prefix of "@test_case_"
17
+ When the ids in the test suite are validated
18
+ Then the following tests are found to be missing ids:
19
+ | path/to/has_untagged_tests.feature:3 |
20
+
21
+ Scenario: Detection of missing test ids when present
22
+ Given the following feature file:
23
+ """
24
+ Feature:
25
+
26
+ @test_case_42
27
+ Scenario:
28
+ * a step
29
+ """
30
+ And a tag prefix of "@test_case_"
31
+ When the ids in the test suite are validated
32
+ Then no tests are found to be missing ids
33
+
34
+ Scenario: Detection of missing sub-id in an outline row when present
35
+ Given the following feature file "has_untagged_rows.feature":
36
+ """
37
+ Feature:
38
+
39
+ @test_case_4
40
+ Scenario Outline:
41
+ * a step
42
+ Examples:
43
+ | test_case_id | param |
44
+ | | 123 |
45
+ | bad_id | 456 |
46
+ """
47
+ And a tag prefix of "@test_case_"
48
+ When the ids in the test suite are validated
49
+ Then the following tests rows are found to be missing sub ids:
50
+ | path/to/has_untagged_rows.feature:8 |
51
+
52
+ Scenario: Detection of missing sub-id in an outline row when not present
53
+ Given the following feature file:
54
+ """
55
+ Feature:
56
+
57
+ @test_case_4
58
+ Scenario Outline:
59
+ * a step
60
+ Examples:
61
+ | test_case_id | param |
62
+ | 4-1 | 123 |
63
+ | 4-2 | 456 |
64
+ """
65
+ And a tag prefix of "@test_case_"
66
+ When the ids in the test suite are validated
67
+ Then no tests rows are found to be missing sub ids
68
+
69
+ Scenario: Detection of missing sub-id parameter column in an outline example when present
70
+ Given the following feature file "has_missing_id_param.feature":
71
+ """
72
+ Feature:
73
+
74
+ @test_case_4
75
+ Scenario Outline:
76
+ * a step
77
+ Examples:
78
+ | param |
79
+ | 123 |
80
+ """
81
+ And a tag prefix of "@test_case_"
82
+ When the ids in the test suite are validated
83
+ Then the following tests examples are found to be missing a parameter for sub ids:
84
+ | path/to/has_missing_id_param.feature:6 |
85
+
86
+ Scenario: Detection of missing sub-id parameter column in an outline example when not present
87
+ Given the following feature file:
88
+ """
89
+ Feature:
90
+
91
+ @test_case_4
92
+ Scenario Outline:
93
+ * a step
94
+ Examples:
95
+ | test_case_id | param |
96
+ | 4-1 | 123 |
97
+ """
98
+ And a tag prefix of "@test_case_"
99
+ When the ids in the test suite are validated
100
+ Then no test examples are found to be missing id parameters
101
+
102
+ Scenario: Detection of duplicate ids when present
103
+ Given the following feature file "has_duplicated_tag.feature":
104
+ """
105
+ Feature:
106
+
107
+ @test_case_1
108
+ Scenario:
109
+ * a step
110
+
111
+ @test_case_1
112
+ Scenario:
113
+ * a step
114
+ """
115
+ And a tag prefix of "@test_case_"
116
+ When the ids in the test suite are validated
117
+ Then the following tests are found to have a duplicated id:
118
+ | path/to/has_duplicated_tag.feature:4 |
119
+ | path/to/has_duplicated_tag.feature:8 |
120
+
121
+ Scenario: Detection of duplicate ids when not present
122
+ Given the following feature file:
123
+ """
124
+ Feature:
125
+
126
+ @test_case_1
127
+ Scenario:
128
+ * a step
129
+
130
+ @test_case_2
131
+ Scenario:
132
+ * a step
133
+ """
134
+ And a tag prefix of "@test_case_"
135
+ When the ids in the test suite are validated
136
+ Then no tests are found to have duplicated ids
137
+
138
+ Scenario: Detection of duplicate sub-ids when present
139
+ Given the following feature file "has_duplicated_id.feature":
140
+ """
141
+ Feature:
142
+
143
+ @test_case_2
144
+ Scenario Outline:
145
+ * a step
146
+ Examples:
147
+ | test_case_id | param |
148
+ | 2-1 | 123 |
149
+ | 2-2 | 123 |
150
+ Examples:
151
+ | test_case_id | param |
152
+ | 2-1 | 123 |
153
+ | 2-1 | 123 |
154
+ """
155
+ And a tag prefix of "@test_case_"
156
+ When the ids in the test suite are validated
157
+ Then the following tests example rows are found to have duplicated sub ids:
158
+ | path/to/has_duplicated_id.feature:8 |
159
+ | path/to/has_duplicated_id.feature:12 |
160
+ | path/to/has_duplicated_id.feature:13 |
161
+
162
+ Scenario: Detection of duplicate sub-ids when not present
163
+ Given the following feature file:
164
+ """
165
+ Feature:
166
+
167
+ @test_case_2
168
+ Scenario Outline:
169
+ * a step
170
+ Examples:
171
+ | test_case_id | param |
172
+ | 2-1 | 123 |
173
+ | 2-2 | 123 |
174
+ Examples:
175
+ | test_case_id | param |
176
+ | 2-3 | 123 |
177
+ | 2-4 | 123 |
178
+ """
179
+ And a tag prefix of "@test_case_"
180
+ When the ids in the test suite are validated
181
+ Then no test example rows are found to have duplicated sub ids
182
+
183
+ Scenario: Row sub id does not match test id when present
184
+ Note: An empty id is not considered a mismatch with the parent id. It is counted as a missing sub-id instead.
185
+
186
+ Given the following feature file "has_mismatched_id.feature":
187
+ """
188
+ Feature:
189
+
190
+ @test_case_4
191
+ Scenario Outline: mismatched tag
192
+ * a step
193
+ Examples:
194
+ | test_case_id | param |
195
+ | 2-1 | 123 |
196
+
197
+ Scenario Outline: no tag and non-empty sub-id
198
+ * a step
199
+ Examples:
200
+ | test_case_id | param |
201
+ | 2-1 | 123 |
202
+
203
+ Scenario Outline: no tag and empty sub-id
204
+ * a step
205
+ Examples:
206
+ | test_case_id | param |
207
+ | | 123 |
208
+
209
+ @test_case_5
210
+ Scenario Outline: tag and empty sub-id
211
+ * a step
212
+ Examples:
213
+ | test_case_id | param |
214
+ | | 123 |
215
+ """
216
+ And a tag prefix of "@test_case_"
217
+ When the ids in the test suite are validated
218
+ Then the following tests example rows are found to have mismatched sub ids:
219
+ | path/to/has_mismatched_id.feature:8 |
220
+ | path/to/has_mismatched_id.feature:14 |
221
+
222
+ Scenario: Row sub id does not match test id when not present
223
+ Given the following feature file:
224
+ """
225
+ Feature:
226
+
227
+ @test_case_4
228
+ Scenario Outline:
229
+ * a step
230
+ Examples:
231
+ | test_case_id | param |
232
+ | 4-1 | 123 |
233
+ """
234
+ And a tag prefix of "@test_case_"
235
+ When the ids in the test suite are validated
236
+ Then no test example rows are found to have mismatched ids
237
+
238
+ Scenario: More than one id tag when present
239
+ Given the following feature file "has_multiple_test_ids.feature":
240
+ """
241
+ Feature:
242
+
243
+ @test_case_1
244
+ @test_case_2
245
+ Scenario:
246
+ * a step
247
+ """
248
+ And a tag prefix of "@test_case_"
249
+ When the ids in the test suite are validated
250
+ Then the following tests are found to have multiple test ids:
251
+ | path/to/has_multiple_test_ids.feature:5 |
252
+
253
+ Scenario: More than one id tag when not present
254
+ Given the following feature file:
255
+ """
256
+ Feature:
257
+
258
+ @test_case_1
259
+ Scenario:
260
+ * a step
261
+ """
262
+ And a tag prefix of "@test_case_"
263
+ When the ids in the test suite are validated
264
+ Then no tests are found to have multiple test ids
265
+
266
+ Scenario: Sub id is malformed when present
267
+ Given the following feature file "has_mismatched_id.feature":
268
+ """
269
+ Feature:
270
+
271
+ @test_case_4
272
+ Scenario Outline:
273
+ * a step
274
+ Examples:
275
+ | test_case_id | param |
276
+ | 2-1x | 123 |
277
+ | | |
278
+ | trash | 123 |
279
+ """
280
+ And a tag prefix of "@test_case_"
281
+ When the ids in the test suite are validated
282
+ Then the following tests example rows are found to have malformed sub ids:
283
+ | path/to/has_mismatched_id.feature:8 |
284
+ | path/to/has_mismatched_id.feature:10 |
285
+
286
+ Scenario: Sub id is malformed when not present
287
+ Given the following feature file:
288
+ """
289
+ Feature:
290
+
291
+ @test_case_4
292
+ Scenario Outline:
293
+ * a step
294
+ Examples:
295
+ | test_case_id | param |
296
+ | 4-1 | 123 |
297
+ """
298
+ And a tag prefix of "@test_case_"
299
+ When the ids in the test suite are validated
300
+ Then no test example rows are found to have malformed sub ids
301
+
302
+ Scenario: Features cannot have test case id tags, present
303
+
304
+ Id tags should only apply to a single test. Their presence at the feature level may cause them to apply to multiple
305
+ tests.
306
+
307
+ Given the following feature file "has_a_feature_level_test_tag.feature":
308
+ """
309
+ @test_case_99
310
+ Feature:
311
+
312
+ @test_case_1
313
+ Scenario:
314
+ * a step
315
+ """
316
+ And a tag prefix of "@test_case_"
317
+ When the ids in the test suite are validated
318
+ Then the following feature is found to have a test case tag:
319
+ | path/to/has_a_feature_level_test_tag.feature:2 |
320
+
321
+ Scenario: Features cannot have test case id tags, not present
322
+ Given the following feature file "has_no_feature_level_test_tag.feature":
323
+ """
324
+ Feature:
325
+
326
+ @test_case_1
327
+ Scenario:
328
+ * a step
329
+ """
330
+ And a tag prefix of "@test_case_"
331
+ When the ids in the test suite are validated
332
+ Then no feature is found to have a test case tag
333
+
334
+ Scenario: Detection of missing test ids when present
335
+ Given the following feature file:
336
+ """
337
+ Feature:
338
+
339
+ @test_case_42
340
+ Scenario:
341
+ * a step
342
+ """
343
+ And a tag prefix of "@test_case_"
344
+ When the ids in the test suite are validated
345
+ Then no tests are found to be missing ids
346
+
347
+ Scenario: Validation covers entire test suite
348
+ Given the following feature file "has_untagged_tests.feature":
349
+ """
350
+ Feature:
351
+
352
+ Scenario:
353
+ * a step
354
+ """
355
+ And the following feature file "has_even_more_untagged_tests.feature":
356
+ """
357
+ Feature:
358
+
359
+ Scenario Outline:
360
+ * a step
361
+ Examples:
362
+ | param |
363
+ """
364
+ And a tag prefix of "@test_case_"
365
+ When the ids in the test suite are validated
366
+ Then the following tests are found to be missing ids:
367
+ | path/to/has_untagged_tests.feature:3 |
368
+ | path/to/has_even_more_untagged_tests.feature:3 |