cuke_cataloger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,362 @@
1
+ Feature: Tag indexing
2
+
3
+ The tool is capable of determining which indexes are already in use in a test suite. If no other set of indexes is
4
+ provided, these existing indexes are what will be used to pick what indexes the tool will start with when tagging.
5
+ Using this default, new indexes start after the highest found index so as not to repeat the indexes of older tests
6
+ that might have since been removed. This default behavior can be overridden by providing an initial index from which
7
+ to start tagging.
8
+
9
+ An analogous principle is used for outlines.
10
+
11
+
12
+ Background:
13
+ * a tag prefix of "@test_case_"
14
+
15
+ Scenario: Used indexes can be determined
16
+ Given the following feature file "file1.feature":
17
+ """
18
+ Feature:
19
+
20
+ Scenario:
21
+ * a step
22
+
23
+ @test_case_1
24
+ Scenario:
25
+ * a step
26
+
27
+ @test_case_7
28
+ Scenario Outline:
29
+ * a step
30
+ Examples: with rows
31
+ | test_case_id | param 1 |
32
+ | 7-1 | value 1 |
33
+ Examples: without rows
34
+ | test_case_id | param 1 |
35
+ Examples: with empty rows
36
+ | test_case_id | param 1 |
37
+ | | value 1 |
38
+ | 7-2 | value 2 |
39
+ Examples: without an id parameter
40
+ | param 1 |
41
+ | value 1 |
42
+
43
+ #Missing the parent tag but the sub-tags still count
44
+ Scenario Outline:
45
+ * a step
46
+ Examples: with rows
47
+ | test_case_id | param 1 |
48
+ | 8-1 | value 1 |
49
+ Examples: with a non-indexed id
50
+ | test_case_id | param 1 |
51
+ | trash | value 1 |
52
+ """
53
+ And the following feature file "file2.feature":
54
+ """
55
+ Feature: Just another feature to make sure that the entire suite is checked
56
+
57
+ @test_case_5
58
+ Scenario:
59
+ * a step
60
+ """
61
+ When the existing ids are determined
62
+ Then the following ids are found:
63
+ | 1 |
64
+ | 5 |
65
+ | 7 |
66
+ | 7-1 |
67
+ | 7-2 |
68
+ | 8-1 |
69
+
70
+
71
+ Scenario: No existing tags
72
+ Given the following feature file:
73
+ """
74
+ Feature:
75
+
76
+ Scenario:
77
+ * a step
78
+ """
79
+ When the file is processed
80
+ Then the resulting file is:
81
+ """
82
+ Feature:
83
+
84
+ @test_case_1
85
+ Scenario:
86
+ * a step
87
+ """
88
+
89
+ Scenario: Existing tags
90
+ Given the following feature file:
91
+ """
92
+ Feature:
93
+
94
+ Scenario:
95
+ * a step
96
+
97
+ @test_case_1
98
+ Scenario:
99
+ * a step
100
+ """
101
+ And the following feature file:
102
+ """
103
+ Feature: Another file to test that the entire suite is checked
104
+
105
+ @test_case_5
106
+ Scenario:
107
+ * a step
108
+ """
109
+ When the file is processed
110
+ Then the resulting file "1" is:
111
+ """
112
+ Feature:
113
+
114
+ @test_case_6
115
+ Scenario:
116
+ * a step
117
+
118
+ @test_case_1
119
+ Scenario:
120
+ * a step
121
+ """
122
+ And the resulting file "2" is:
123
+ """
124
+ Feature: Another file to test that the entire suite is checked
125
+
126
+ @test_case_5
127
+ Scenario:
128
+ * a step
129
+ """
130
+
131
+ Scenario: Explicit starting index
132
+
133
+ Note: By explicitly setting the starting index, there is no guarantee that the indexes used will not conflict with
134
+ existing indexes.
135
+
136
+ Given the following feature file:
137
+ """
138
+ Feature:
139
+
140
+ Scenario:
141
+ * a step
142
+
143
+ @test_case_1
144
+ Scenario:
145
+ * a step
146
+
147
+ Scenario:
148
+ * a step
149
+ """
150
+ And a start index of "1"
151
+ When the file is processed
152
+ Then the resulting file is:
153
+ """
154
+ Feature:
155
+
156
+ @test_case_1
157
+ Scenario:
158
+ * a step
159
+
160
+ @test_case_1
161
+ Scenario:
162
+ * a step
163
+
164
+ @test_case_2
165
+ Scenario:
166
+ * a step
167
+ """
168
+
169
+
170
+ Scenario: Outline, no existing sub-ids
171
+ Given the following feature file:
172
+ """
173
+ Feature:
174
+
175
+ Scenario Outline:
176
+ * a <param>
177
+ Examples:
178
+ | param |
179
+ | value |
180
+ """
181
+ When the file is processed
182
+ Then the resulting file is:
183
+ """
184
+ Feature:
185
+
186
+ @test_case_1
187
+ Scenario Outline:
188
+ * a <param>
189
+ Examples:
190
+ | param | test_case_id |
191
+ | value | 1-1 |
192
+ """
193
+
194
+ Scenario: Outline, existing sub-ids
195
+
196
+ Note: Existing sub ids count against the indexes available for their associated parent id. If ids are mismatched (see
197
+ the feature on test case id validation), indexes are still assigned appropriately to avoid duplication.
198
+
199
+ Given the following feature file:
200
+ """
201
+ Feature:
202
+
203
+ @test_case_1
204
+ Scenario Outline:
205
+ * a <param>
206
+ Examples:
207
+ | param | test_case_id |
208
+ | value1 | 1-1 |
209
+ | value2 | |
210
+ Examples:
211
+ | param | test_case_id |
212
+ | value1 | 1-3 |
213
+ | value2 | |
214
+
215
+ Scenario Outline:
216
+ * a <param>
217
+ Examples: with a sub-id not associated with the parent test case
218
+ | param | test_case_id |
219
+ | value1 | 8-1 |
220
+ | value2 | |
221
+
222
+ @test_case_8
223
+ Scenario Outline: the outline that sub-id 8-1 should count against
224
+ * a <param>
225
+ Examples:
226
+ | param | test_case_id |
227
+ | value2 | |
228
+ """
229
+ When the file is processed
230
+ Then the resulting file is:
231
+ """
232
+ Feature:
233
+
234
+ @test_case_1
235
+ Scenario Outline:
236
+ * a <param>
237
+ Examples:
238
+ | param | test_case_id |
239
+ | value1 | 1-1 |
240
+ | value2 | 1-4 |
241
+ Examples:
242
+ | param | test_case_id |
243
+ | value1 | 1-3 |
244
+ | value2 | 1-5 |
245
+
246
+ @test_case_9
247
+ Scenario Outline:
248
+ * a <param>
249
+ Examples: with a sub-id not associated with the parent test case
250
+ | param | test_case_id |
251
+ | value1 | 8-1 |
252
+ | value2 | 9-1 |
253
+
254
+ @test_case_8
255
+ Scenario Outline: the outline that sub-id 8-1 should count against
256
+ * a <param>
257
+ Examples:
258
+ | param | test_case_id |
259
+ | value2 | 8-2 |
260
+ """
261
+
262
+ Scenario: Outline, explicit starting index
263
+
264
+ Note: Explicit starting indexes for sub-ids can be declared even if the parent id does not exist yet.
265
+
266
+ Note: By explicitly setting the starting index, there is no guarantee that the indexes used will not conflict with
267
+ existing indexes.
268
+
269
+ Given the following feature file:
270
+ """
271
+ Feature:
272
+
273
+ @test_case_1
274
+ Scenario Outline:
275
+ * a <param>
276
+ Examples:
277
+ | param | test_case_id |
278
+ | value1 | 1-2 |
279
+ | value2 | |
280
+ | value3 | |
281
+
282
+ Scenario Outline:
283
+ * a <param>
284
+ Examples:
285
+ | param | test_case_id |
286
+ | value1 | 2-1 |
287
+ | value2 | |
288
+ | value3 | |
289
+ """
290
+ And a start index of "2"
291
+ And a start index of "1" for testcase "1"
292
+ And a start index of "1" for testcase "2"
293
+ When the file is processed
294
+ Then the resulting file is:
295
+ """
296
+ Feature:
297
+
298
+ @test_case_1
299
+ Scenario Outline:
300
+ * a <param>
301
+ Examples:
302
+ | param | test_case_id |
303
+ | value1 | 1-2 |
304
+ | value2 | 1-1 |
305
+ | value3 | 1-2 |
306
+
307
+ @test_case_2
308
+ Scenario Outline:
309
+ * a <param>
310
+ Examples:
311
+ | param | test_case_id |
312
+ | value1 | 2-1 |
313
+ | value2 | 2-1 |
314
+ | value3 | 2-2 |
315
+ """
316
+
317
+ Scenario: Default indexing still applies to non-explicit indexes
318
+ Given the following feature file:
319
+ """
320
+ Feature:
321
+
322
+ Scenario Outline: Letting the default set the primary index
323
+ * a <param>
324
+ Examples:
325
+ | param | test_case_id |
326
+ | value1 | 1-2 |
327
+ | value2 | 3-2 |
328
+ | value3 | |
329
+
330
+ @test_case_2
331
+ Scenario Outline:
332
+ * a <param>
333
+ Examples:
334
+ | param | test_case_id |
335
+ | value1 | 2-1 |
336
+ | value2 | |
337
+ | value3 | |
338
+ """
339
+ And a start index of "1" for testcase "2"
340
+ When the file is processed
341
+ Then the resulting file is:
342
+ """
343
+ Feature:
344
+
345
+ @test_case_3
346
+ Scenario Outline: Letting the default set the primary index
347
+ * a <param>
348
+ Examples:
349
+ | param | test_case_id |
350
+ | value1 | 1-2 |
351
+ | value2 | 3-2 |
352
+ | value3 | 3-3 |
353
+
354
+ @test_case_2
355
+ Scenario Outline:
356
+ * a <param>
357
+ Examples:
358
+ | param | test_case_id |
359
+ | value1 | 2-1 |
360
+ | value2 | 2-1 |
361
+ | value3 | 2-2 |
362
+ """
@@ -0,0 +1,59 @@
1
+ Feature: Scanning for tagged test cases
2
+
3
+ The test tagger is capable of finding all existing test objects within a test suite that have an id.
4
+
5
+
6
+ Scenario: Finds all tagged tests
7
+ Given the following feature file "file1.feature":
8
+ """
9
+ Feature:
10
+
11
+ Scenario:
12
+ * a step
13
+
14
+ @test_case_1
15
+ Scenario:
16
+ * a step
17
+
18
+ @test_case_7
19
+ Scenario Outline:
20
+ * a step
21
+ Examples: with rows
22
+ | test_case_id | param 1 |
23
+ | 7-1 | value 1 |
24
+ Examples: without rows
25
+ | test_case_id | param 1 |
26
+ Examples: with empty rows
27
+ | test_case_id | param 1 |
28
+ | | value 1 |
29
+ | 7-2 | value 2 |
30
+ Examples: without an id parameter
31
+ | param 1 |
32
+ | value 1 |
33
+
34
+ #Missing the parent tag but the sub-tags still count
35
+ Scenario Outline:
36
+ * a step
37
+ Examples: with rows
38
+ | test_case_id | param 1 |
39
+ | 8-1 | value 1 |
40
+ | trash | value 1 |
41
+ """
42
+ And the following feature file "file2.feature":
43
+ """
44
+ Feature: Just another feature to make sure that the entire suite is checked
45
+
46
+ @test_case_5
47
+ Scenario:
48
+ * a step
49
+ """
50
+ And a tag prefix of "@test_case_"
51
+ When the files are scanned
52
+ Then the following tagged test objects are found:
53
+ | path/to/file1.feature:7 |
54
+ | path/to/file1.feature:11 |
55
+ | path/to/file1.feature:15 |
56
+ | path/to/file1.feature:21 |
57
+ | path/to/file1.feature:31 |
58
+ | path/to/file1.feature:32 |
59
+ | path/to/file2.feature:4 |
@@ -0,0 +1,32 @@
1
+ Feature: Scan results return useful information
2
+
3
+ Test objects are returned in the results of a scan.
4
+
5
+ Scenario: Scanned scenario
6
+ Given the following feature file "file1.feature":
7
+ """
8
+ Feature:
9
+
10
+ @test_case_1
11
+ Scenario:
12
+ * a step
13
+ """
14
+ And a tag prefix of "@test_case_"
15
+ When the files are scanned
16
+ Then the payload is a test object
17
+
18
+ Scenario: Scanned outline
19
+ Given the following feature file "test_file.feature":
20
+ """
21
+ Feature:
22
+
23
+ @test_case_7
24
+ Scenario Outline:
25
+ * a step
26
+ Examples: with rows
27
+ | test_case_id | param 1 |
28
+ | 7-1 | value 1 |
29
+ """
30
+ And a tag prefix of "@test_case_"
31
+ When the files are scanned
32
+ Then the payload has a test and a test row
@@ -0,0 +1,193 @@
1
+ Feature: Tagging test cases for uniqueness
2
+
3
+ Tests are tagged based on a simple <prefix><unique_id> pattern. Every test gets a tag at the test level and, in the case outlines, a sub-id for each of its example rows. Any test which has already been given an id tag or other id information will not have that information modified by the tagging process.
4
+
5
+
6
+ Background:
7
+ * a tag prefix of "@test_case_"
8
+
9
+
10
+ Scenario: Tagging tests that don't have id tags
11
+
12
+ This is one of the most common cases, wherein new tests have been written but they have not yet been tagged by the tagging tool.
13
+
14
+ Given the following feature file:
15
+ """
16
+ Feature:
17
+
18
+ Scenario:
19
+ * a step
20
+
21
+ Scenario Outline:
22
+ * a step
23
+ Examples: with rows
24
+ | param 1 |
25
+ | value 1 |
26
+ Examples: without rows
27
+ | param 1 |
28
+ """
29
+ When the file is processed
30
+ Then the resulting file is:
31
+ """
32
+ Feature:
33
+
34
+ @test_case_1
35
+ Scenario:
36
+ * a step
37
+
38
+ @test_case_2
39
+ Scenario Outline:
40
+ * a step
41
+ Examples: with rows
42
+ | param 1 | test_case_id |
43
+ | value 1 | 2-1 |
44
+ Examples: without rows
45
+ | param 1 | test_case_id |
46
+ """
47
+
48
+ Scenario: Tagging tests that already have id tags
49
+
50
+ This is the other most common case, wherein existing tests have already been tagged by the tagging tool.
51
+
52
+ Given the following feature file:
53
+ """
54
+ Feature:
55
+
56
+ @test_case_1
57
+ Scenario:
58
+ * a step
59
+
60
+ @test_case_2
61
+ Scenario Outline:
62
+ * a step
63
+ Examples: with rows
64
+ | param 1 | test_case_id |
65
+ | value 1 | 2-1 |
66
+ Examples: without rows
67
+ | param 1 | test_case_id |
68
+ """
69
+ When the file is processed
70
+ Then the resulting file is:
71
+ """
72
+ Feature:
73
+
74
+ @test_case_1
75
+ Scenario:
76
+ * a step
77
+
78
+ @test_case_2
79
+ Scenario Outline:
80
+ * a step
81
+ Examples: with rows
82
+ | param 1 | test_case_id |
83
+ | value 1 | 2-1 |
84
+ Examples: without rows
85
+ | param 1 | test_case_id |
86
+ """
87
+
88
+
89
+ Scenario: Tagging outlines that are partially 'filled in'
90
+
91
+ Whereas scenarios either have an id tag or don't, outlines have many more places for identifying information to be placed and it is quite possible that some of that information is already present. Maybe several scenarios were combined into one outline and an id tag got carried over. Maybe an extra row or entire example table was added to an already tagged outline. Maybe someone removed id information by accident. In any case, the missing information is replaced by the tagging tool.
92
+
93
+ Given the following feature file:
94
+ """
95
+ Feature:
96
+
97
+ @test_case_1
98
+ Scenario Outline: Has an id tag, but no sub-ids
99
+ * a step
100
+ Examples: with rows
101
+ | param 1 |
102
+ | value 1 |
103
+ Examples: without rows
104
+ | param 1 |
105
+
106
+ Scenario Outline: Sub-ids present but no top level tag
107
+ * a step
108
+ Examples: Missing row ids
109
+ | param 1 | test_case_id |
110
+ | value 2 | |
111
+ | value 1 | some_id |
112
+ Examples: Already has id column
113
+ | param 1 | test_case_id |
114
+ Examples: Doesn't have id column
115
+ | param 1 |
116
+ | value 3 |
117
+ """
118
+ When the file is processed
119
+ Then the resulting file is:
120
+ """
121
+ Feature:
122
+
123
+ @test_case_1
124
+ Scenario Outline: Has an id tag, but no sub-ids
125
+ * a step
126
+ Examples: with rows
127
+ | param 1 | test_case_id |
128
+ | value 1 | 1-1 |
129
+ Examples: without rows
130
+ | param 1 | test_case_id |
131
+
132
+ @test_case_2
133
+ Scenario Outline: Sub-ids present but no top level tag
134
+ * a step
135
+ Examples: Missing row ids
136
+ | param 1 | test_case_id |
137
+ | value 2 | 2-1 |
138
+ | value 1 | some_id |
139
+ Examples: Already has id column
140
+ | param 1 | test_case_id |
141
+ Examples: Doesn't have id column
142
+ | param 1 | test_case_id |
143
+ | value 3 | 2-2 |
144
+ """
145
+
146
+ Scenario: Tagging a multi-file test suite
147
+ Given the following feature file:
148
+ """
149
+ Feature:
150
+
151
+ Scenario:
152
+ * a step
153
+ """
154
+ And the following feature file:
155
+ """
156
+ Feature:
157
+
158
+ Scenario Outline:
159
+ * a step
160
+ Examples: with rows
161
+ | param 1 |
162
+ | value 1 |
163
+ Examples: without rows
164
+ | param 1 |
165
+ Examples: some more rows
166
+ | param 1 |
167
+ | value 1 |
168
+ """
169
+ When the files are processed
170
+ Then the resulting first file is:
171
+ """
172
+ Feature:
173
+
174
+ @test_case_1
175
+ Scenario:
176
+ * a step
177
+ """
178
+ And the resulting second file is:
179
+ """
180
+ Feature:
181
+
182
+ @test_case_2
183
+ Scenario Outline:
184
+ * a step
185
+ Examples: with rows
186
+ | param 1 | test_case_id |
187
+ | value 1 | 2-1 |
188
+ Examples: without rows
189
+ | param 1 | test_case_id |
190
+ Examples: some more rows
191
+ | param 1 | test_case_id |
192
+ | value 1 | 2-2 |
193
+ """