forked from cucumber/cucumber-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcucumber_cli.feature
584 lines (449 loc) · 14.1 KB
/
cucumber_cli.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
Feature: Cucumber command line
In order to write better software
Developers should be able to execute requirements as tests
Scenario: Run single scenario with missing step definition
When I run cucumber -q features/sample.feature:5
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
1 scenario (1 undefined)
1 step (1 undefined)
"""
Scenario: Fail with --strict
When I run cucumber -q features/sample.feature:5 --strict
Then it should fail with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
Undefined step: "missing" (Cucumber::Undefined)
features/sample.feature:7:in `Given missing'
1 scenario (1 undefined)
1 step (1 undefined)
"""
Scenario: Succeed with --strict
When I run cucumber -q features/sample.feature:10 --strict
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
1 scenario (1 passed)
1 step (1 passed)
"""
Scenario: Specify 2 line numbers where one is a tag
When I run cucumber -q features/sample.feature:5:16
Then it should fail with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
@four
Scenario: Failing
Given failing
\"\"\"
hello
\"\"\"
FAIL (RuntimeError)
./features/step_definitions/sample_steps.rb:2:in `flunker'
./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
features/sample.feature:18:in `Given failing'
Failing Scenarios:
cucumber features/sample.feature:17
2 scenarios (1 failed, 1 undefined)
2 steps (1 failed, 1 undefined)
"""
Scenario: Require missing step definition from elsewhere
When I run cucumber -q -r ../../legacy_features/step_definitions/extra_steps.rb features/sample.feature:5
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
1 scenario (1 passed)
1 step (1 passed)
"""
Scenario: Specify the line number of a row
When I run cucumber -q features/sample.feature:12
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
1 scenario (1 passed)
1 step (1 passed)
"""
Scenario: Use @-notation to specify a file containing feature file list
When I run cucumber -q @list-of-features.txt
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
1 scenario (1 passed)
1 step (1 passed)
"""
Scenario: Run all with progress formatter
When I run cucumber -q --format progress features/sample.feature
Then it should fail with
"""
U.F
(::) failed steps (::)
FAIL (RuntimeError)
./features/step_definitions/sample_steps.rb:2:in `flunker'
./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
features/sample.feature:18:in `Given failing'
Failing Scenarios:
cucumber features/sample.feature:17
3 scenarios (1 failed, 1 undefined, 1 passed)
3 steps (1 failed, 1 undefined, 1 passed)
"""
Scenario: --dry-run
When I run cucumber --dry-run --no-source features/*.feature --tags ~@lots
Then it should pass with
"""
Feature: Calling undefined step
Scenario: Call directly
Given a step definition that calls an undefined step
Scenario: Call via another
Given call step "a step definition that calls an undefined step"
Feature: Failing expectation
Scenario: Failing expectation
Given failing expectation
Feature: Lots of undefined
Scenario: Implement me
Given it snows in Sahara
Given it's 40 degrees in Norway
And it's 40 degrees in Norway
When I stop procrastinating
And there is world peace
Feature: multiline
Background: I'm a multiline name
which goes on and on and on for three lines
yawn
Given passing without a table
Scenario: I'm a multiline name
which goes on and on and on for three lines
yawn
Given passing without a table
Scenario Outline: I'm a multiline name
which goes on and on and on for three lines
yawn
Given <state> without a table
Examples:
| state |
| passing |
Scenario Outline: name
Given <state> without a table
Examples: I'm a multiline name
which goes on and on and on for three lines
yawn
| state |
| passing |
Feature: Outline Sample
Scenario: I have no steps
Scenario Outline: Test state
Given <state> without a table
Given <other_state> without a table
Examples: Rainbow colours
| state | other_state |
| missing | passing |
| passing | passing |
| failing | passing |
Examples: Only passing
| state | other_state |
| passing | passing |
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
@four
Scenario: Failing
Given failing
\"\"\"
hello
\"\"\"
Feature: search examples
Background: Hantu Pisang background match
Given passing without a table
Scenario: should match Hantu Pisang
Given passing without a table
Scenario: Ignore me
Given failing without a table
Scenario Outline: Ignore me
Given <state> without a table
Examples:
| state |
| failing |
Scenario Outline: Hantu Pisang match
Given <state> without a table
Examples:
| state |
| passing |
Scenario Outline: no match in name but in examples
Given <state> without a table
Examples: Hantu Pisang
| state |
| passing |
Examples: Ignore me
| state |
| failing |
@sample_one
Feature: Tag samples
@sample_two @sample_four
Scenario: Passing
Given missing
@sample_three
Scenario Outline:
Given <state>
Examples:
| state |
| missing |
@sample_three @sample_four
Scenario: Skipped
Given missing
Feature: undefined multiline args
Scenario: pystring
Given a pystring
\"\"\"
example with <html> entities
\"\"\"
Scenario: table
Given a table
| table |
| example |
26 scenarios (17 skipped, 8 undefined, 1 passed)
42 steps (30 skipped, 12 undefined)
"""
Scenario: Multiple formatters and outputs
When I run cucumber --format progress --out tmp/progress.txt --format pretty --out tmp/pretty.txt --no-source --dry-run --no-snippets features/lots_of_undefined.feature
Then STDERR should be empty
Then "fixtures/self_test/tmp/progress.txt" should contain
"""
UUUUU
1 scenario (1 undefined)
5 steps (5 undefined)
"""
And "fixtures/self_test/tmp/pretty.txt" should contain
"""
Feature: Lots of undefined
Scenario: Implement me
Given it snows in Sahara
Given it's 40 degrees in Norway
And it's 40 degrees in Norway
When I stop procrastinating
And there is world peace
1 scenario (1 undefined)
5 steps (5 undefined)
"""
Scenario: Run feature elements which matches a name using --name
When I run cucumber --name Pisang -q features/
Then it should pass with
"""
Feature: search examples
Background: Hantu Pisang background match
Given passing without a table
Scenario: should match Hantu Pisang
Given passing without a table
Scenario Outline: Hantu Pisang match
Given <state> without a table
Examples:
| state |
| passing |
Scenario Outline: no match in name but in examples
Given <state> without a table
Examples: Hantu Pisang
| state |
| passing |
3 scenarios (3 passed)
6 steps (6 passed)
"""
Scenario: Run a single background which matches a name using --name (Useful if there is an error in it)
When I run cucumber --name 'Hantu Pisang background' -q features/
Then it should pass with
"""
Feature: search examples
Background: Hantu Pisang background match
Given passing without a table
0 scenarios
1 step (1 passed)
"""
Scenario: Run with a tag that exists on 2 scenarios
When I run cucumber -q features --tags @three
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
2 scenarios (1 undefined, 1 passed)
2 steps (1 undefined, 1 passed)
"""
Scenario: Run with a tag that exists on 1 feature
When I run cucumber -q features --tags @one
Then it should fail with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
@four
Scenario: Failing
Given failing
\"\"\"
hello
\"\"\"
FAIL (RuntimeError)
./features/step_definitions/sample_steps.rb:2:in `flunker'
./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
features/sample.feature:18:in `Given failing'
Failing Scenarios:
cucumber features/sample.feature:17
3 scenarios (1 failed, 1 undefined, 1 passed)
3 steps (1 failed, 1 undefined, 1 passed)
"""
Scenario: Run with a negative tag
When I run cucumber -q features/sample.feature --no-source --dry-run --tags ~@four
Then it should pass with
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
2 scenarios (1 skipped, 1 undefined)
2 steps (1 skipped, 1 undefined)
"""
Scenario: Run with limited tag count, blowing it on scenario
When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags @sample_three:1
Then it should fail with
"""
@sample_three occurred 2 times, but the limit was set to 1
features/tags_sample.feature:11
features/tags_sample.feature:16
"""
Scenario: Run with limited tag count, blowing it via feature inheritance
When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags @sample_one:1
Then it should fail with
"""
@sample_one occurred 3 times, but the limit was set to 1
features/tags_sample.feature:5
features/tags_sample.feature:11
features/tags_sample.feature:16
"""
Scenario: Run with limited tag count using negative tag, blowing it via a tag that is not run
When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags ~@sample_one:1
Then it should fail with
"""
@sample_one occurred 3 times, but the limit was set to 1
"""
Scenario: Reformat files with --autoformat
When I run cucumber --autoformat tmp/formatted features
Then STDERR should be empty
Then "fixtures/self_test/tmp/formatted/features/sample.feature" should contain
"""
# Feature comment
@one
Feature: Sample
@two @three
Scenario: Missing
Given missing
# Scenario comment
@three
Scenario: Passing
Given passing
| a | b |
| c | d |
@four
Scenario: Failing
Given failing
\"\"\"
hello
\"\"\"
"""
Scenario: Run feature elements which match a name using -n
When I run cucumber -n Pisang -q features/
Then STDERR should be empty
Then it should pass with
"""
Feature: search examples
Background: Hantu Pisang background match
Given passing without a table
Scenario: should match Hantu Pisang
Given passing without a table
Scenario Outline: Hantu Pisang match
Given <state> without a table
Examples:
| state |
| passing |
Scenario Outline: no match in name but in examples
Given <state> without a table
Examples: Hantu Pisang
| state |
| passing |
3 scenarios (3 passed)
6 steps (6 passed)
"""