Skip to content

Commit 10f0951

Browse files
committed
Do not test for of use empty scenarios in the specs/features.
1 parent 44c61da commit 10f0951

File tree

5 files changed

+33
-162
lines changed

5 files changed

+33
-162
lines changed

features/docs/cli/execute_with_tag_filter.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Feature: Tag logic
2323
2424
@ignore
2525
Scenario: And yet another Example
26+
Given passing
2627
"""
2728

2829
Scenario: ANDing tags
@@ -78,9 +79,10 @@ Feature: Tag logic
7879
7980
@ignore
8081
Scenario: And yet another Example
82+
Given passing
8183
82-
2 scenarios (1 undefined, 1 passed)
83-
1 step (1 undefined)
84+
2 scenarios (2 undefined)
85+
2 steps (2 undefined)
8486
"""
8587

8688
Scenario: Run with limited tag count, blowing it on scenario

features/docs/gherkin/outlines.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ Feature: Scenario outlines
5050
"""
5151
Feature: Outline Sample
5252
53-
Scenario: I have no steps
54-
5553
Scenario Outline: Test state
5654
Given <state> without a table
5755
Given <other_state> without a table
@@ -73,7 +71,7 @@ Feature: Scenario outlines
7371
Failing Scenarios:
7472
cucumber features/outline_sample.feature:12
7573
76-
5 scenarios (1 failed, 1 undefined, 3 passed)
74+
4 scenarios (1 failed, 1 undefined, 2 passed)
7775
8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
7876
"""
7977

@@ -154,7 +152,7 @@ Feature: Scenario outlines
154152
Failing Scenarios:
155153
cucumber features/outline_sample.feature:12
156154
157-
5 scenarios (1 failed, 1 undefined, 3 passed)
155+
4 scenarios (1 failed, 1 undefined, 2 passed)
158156
8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
159157
160158
"""

spec/cucumber/formatter/json_spec.rb

Lines changed: 26 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,6 @@ module Formatter
1818
run_defined_feature
1919
end
2020

21-
describe 'with a scenario with no steps' do
22-
define_feature <<-FEATURE
23-
Feature: Banana party
24-
25-
Scenario: Monkey eats bananas
26-
FEATURE
27-
28-
it 'outputs the json data' do
29-
expect(load_normalised_json(@out)).to eq MultiJson.load(%{
30-
[{"id": "banana-party",
31-
"uri": "spec.feature",
32-
"keyword": "Feature",
33-
"name": "Banana party",
34-
"line": 1,
35-
"description": "",
36-
"elements":
37-
[{"id": "banana-party;monkey-eats-bananas",
38-
"keyword": "Scenario",
39-
"name": "Monkey eats bananas",
40-
"line": 3,
41-
"description": "",
42-
"type": "scenario"}]}]})
43-
end
44-
end
45-
4621
describe 'with a scenario with an undefined step' do
4722
define_feature <<-FEATURE
4823
Feature: Banana party
@@ -106,7 +81,7 @@ module Formatter
10681
[{"keyword": "Given ",
10782
"name": "there are bananas",
10883
"line": 4,
109-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:87"},
84+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:62"},
11085
"result": {"status": "passed",
11186
"duration": 1}}]}]}]})
11287
end
@@ -143,9 +118,9 @@ module Formatter
143118
[{"keyword": "Given ",
144119
"name": "there are bananas",
145120
"line": 4,
146-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:124"},
121+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:99"},
147122
"result": {"status": "failed",
148-
"error_message": "no bananas (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:124:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
123+
"error_message": "no bananas (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:99:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
149124
"duration": 1}}]}]}]})
150125
end
151126
end
@@ -181,9 +156,9 @@ module Formatter
181156
[{"keyword": "Given ",
182157
"name": "there are bananas",
183158
"line": 4,
184-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:162"},
159+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:137"},
185160
"result": {"status": "pending",
186-
"error_message": "TODO (Cucumber::Pending)\\n./spec/cucumber/formatter/json_spec.rb:162:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
161+
"error_message": "TODO (Cucumber::Pending)\\n./spec/cucumber/formatter/json_spec.rb:137:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
187162
"duration": 1}}]}]}]})
188163
end
189164
end
@@ -223,7 +198,7 @@ module Formatter
223198
[{"keyword": "Given ",
224199
"name": "there are bananas",
225200
"line": 8,
226-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:204"},
201+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:179"},
227202
"result": {"status": "passed",
228203
"duration": 1}}]}]}]})
229204
end
@@ -277,7 +252,7 @@ module Formatter
277252
[{"keyword": "Given ",
278253
"name": "there are bananas",
279254
"line": 6,
280-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:252"},
255+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:227"},
281256
"result": {"status": "passed",
282257
"duration": 1}}]},
283258
{"id": "banana-party;monkey-eats-bananas;fruit-table;2",
@@ -296,7 +271,7 @@ module Formatter
296271
[{"keyword": "Given ",
297272
"name": "there are bananas",
298273
"line": 15,
299-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:252"},
274+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:227"},
300275
"result": {"status": "passed",
301276
"duration": 1}}]}]}]})
302277
end
@@ -355,7 +330,7 @@ module Formatter
355330
[{"keyword": "Given ",
356331
"name": "there are bananas",
357332
"line": 6,
358-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
333+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:307"},
359334
"result": {"status": "passed",
360335
"duration": 1}}]},
361336
{"id": "banana-party;monkey-eats-bananas",
@@ -372,7 +347,7 @@ module Formatter
372347
"line": 11,
373348
"comments": [{"value": "#step comment1",
374349
"line": 10}],
375-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:333"},
350+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:308"},
376351
"result": {"status": "passed",
377352
"duration": 1}}]},
378353
{"keyword": "Background",
@@ -386,7 +361,7 @@ module Formatter
386361
[{"keyword": "Given ",
387362
"name": "there are bananas",
388363
"line": 6,
389-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
364+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:307"},
390365
"result": {"status": "passed",
391366
"duration": 1}}]},
392367
{"id": "banana-party;monkey-eats-bananas;fruit-table;2",
@@ -407,7 +382,7 @@ module Formatter
407382
"line": 22,
408383
"comments": [{"value": "#step comment2",
409384
"line": 15}],
410-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:333"},
385+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:308"},
411386
"result": {"status": "passed",
412387
"duration": 1}}]}]}]})
413388
end
@@ -450,7 +425,7 @@ module Formatter
450425
"doc_string": {"value": "the doc string",
451426
"content_type": "",
452427
"line": 5},
453-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:428"},
428+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:403"},
454429
"result": {"status": "passed",
455430
"duration": 1}}]}]}]})
456431
end
@@ -488,7 +463,7 @@ module Formatter
488463
"name": "there are bananas",
489464
"line": 4,
490465
"output": ["from step"],
491-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:468"},
466+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:443"},
492467
"result": {"status": "passed",
493468
"duration": 1}}]}]}]})
494469
end
@@ -600,7 +575,7 @@ module Formatter
600575
"line": 4,
601576
"embeddings": [{"mime_type": "mime-type",
602577
"data": "YWJj"}],
603-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:578"},
578+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:553"},
604579
"result": {"status": "passed",
605580
"duration": 1}}]}]}]})
606581
end
@@ -645,7 +620,7 @@ module Formatter
645620
"line": 4,
646621
"embeddings": [{"mime_type": "image/png",
647622
"data": "Zm9v"}],
648-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:618"},
623+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:593"},
649624
"result": {"status": "passed",
650625
"duration": 1}}]}]}]})
651626
end
@@ -686,31 +661,31 @@ module Formatter
686661
"description": "",
687662
"type": "scenario",
688663
"before":
689-
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:663"},
664+
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:638"},
690665
"result": {"status": "passed",
691666
"duration": 1}},
692-
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:664"},
667+
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:639"},
693668
"result": {"status": "passed",
694669
"duration": 1}}],
695670
"steps":
696671
[{"keyword": "Given ",
697672
"name": "there are bananas",
698673
"line": 4,
699-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:670"},
674+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:645"},
700675
"result": {"status": "passed",
701676
"duration": 1},
702677
"after":
703-
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:667"},
678+
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:642"},
704679
"result": {"status": "passed",
705680
"duration": 1}},
706-
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:668"},
681+
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:643"},
707682
"result": {"status": "passed",
708683
"duration": 1}}]}],
709684
"after":
710-
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:666"},
685+
[{"match": {"location": "spec/cucumber/formatter/json_spec.rb:641"},
711686
"result": {"status": "passed",
712687
"duration": 1}},
713-
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:665"},
688+
{"match": {"location": "spec/cucumber/formatter/json_spec.rb:640"},
714689
"result": {"status": "passed",
715690
"duration": 1}}]}]}]})
716691
end
@@ -748,13 +723,13 @@ module Formatter
748723
[{"keyword": "Given ",
749724
"name": "there are bananas",
750725
"line": 4,
751-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:729"},
726+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:704"},
752727
"result": {"status": "passed",
753728
"duration": 1}}],
754729
"around":
755730
[{"match": {"location": "unknown_hook_location:1"},
756731
"result": {"status": "failed",
757-
"error_message": "error (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:728:in `Around'",
732+
"error_message": "error (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:703:in `Around'",
758733
"duration": 1}}]}]}]})
759734
end
760735
end
@@ -795,7 +770,7 @@ module Formatter
795770
"rows":
796771
[{"cells": ["aa", "bb"]},
797772
{"cells": ["cc", "dd"]}],
798-
"match": {"location": "spec/cucumber/formatter/json_spec.rb:773"},
773+
"match": {"location": "spec/cucumber/formatter/json_spec.rb:748"},
799774
"result": {"status": "passed",
800775
"duration": 1}}]}]}]})
801776
end

spec/cucumber/formatter/legacy_api/adapter_spec.rb

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -151,66 +151,6 @@ def after_hooks(source)
151151
]
152152
end
153153

154-
it 'a scenario with no steps' do
155-
execute_gherkin do
156-
feature do
157-
scenario
158-
end
159-
end
160-
161-
expect( formatter.legacy_messages ).to eq [
162-
:before_features,
163-
:before_feature,
164-
:before_tags,
165-
:after_tags,
166-
:feature_name,
167-
:before_feature_element,
168-
:before_tags,
169-
:after_tags,
170-
:scenario_name,
171-
:after_feature_element,
172-
:after_feature,
173-
:after_features
174-
]
175-
end
176-
177-
it 'a scenario with no steps coming after another scenario' do
178-
execute_gherkin do
179-
feature do
180-
scenario do
181-
step 'passing'
182-
end
183-
scenario
184-
end
185-
end
186-
expect( formatter.legacy_messages ).to eq [
187-
:before_features,
188-
:before_feature,
189-
:before_tags,
190-
:after_tags,
191-
:feature_name,
192-
:before_feature_element,
193-
:before_tags,
194-
:after_tags,
195-
:scenario_name,
196-
:before_steps,
197-
:before_step,
198-
:before_step_result,
199-
:step_name,
200-
:after_step_result,
201-
:after_step,
202-
:after_steps,
203-
:after_feature_element,
204-
:before_feature_element,
205-
:before_tags,
206-
:after_tags,
207-
:scenario_name,
208-
:after_feature_element,
209-
:after_feature,
210-
:after_features
211-
]
212-
end
213-
214154
it 'a scenario with one step' do
215155
execute_gherkin do
216156
feature do
@@ -1953,38 +1893,6 @@ def apply_after_hooks(test_case)
19531893
end
19541894
end
19551895

1956-
context 'with an exception in an after hook but no steps' do
1957-
it 'prints the exception after the scenario name' do
1958-
filters = [
1959-
Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1960-
Filters::ApplyAfterHooks.new(FailingAfterHook.new),
1961-
AddBeforeAndAfterHooks.new
1962-
]
1963-
execute_gherkin(filters) do
1964-
feature do
1965-
scenario do
1966-
end
1967-
end
1968-
end
1969-
1970-
expect( formatter.legacy_messages ).to eq([
1971-
:before_features,
1972-
:before_feature,
1973-
:before_tags,
1974-
:after_tags,
1975-
:feature_name,
1976-
:before_feature_element,
1977-
:before_tags,
1978-
:after_tags,
1979-
:scenario_name,
1980-
:exception,
1981-
:after_feature_element,
1982-
:after_feature,
1983-
:after_features
1984-
])
1985-
end
1986-
end
1987-
19881896
context 'with an exception in an around hook before the test case is run' do
19891897
class FailingAroundHookBeforeRunningTestCase
19901898
def find_around_hooks(test_case)
@@ -2003,6 +1911,7 @@ def find_around_hooks(test_case)
20031911
execute_gherkin(filters) do
20041912
feature do
20051913
scenario do
1914+
step 'passing'
20061915
end
20071916
end
20081917
end

0 commit comments

Comments
 (0)