cucumber 2.0.0.beta.2 → 2.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +25 -7
  3. data/cucumber.gemspec +1 -1
  4. data/features/docs/defining_steps/nested_steps.feature +0 -1
  5. data/features/docs/defining_steps/printing_messages.feature +1 -0
  6. data/features/docs/defining_steps/table_diffing.feature +9 -4
  7. data/features/docs/exception_in_after_step_hook.feature +1 -0
  8. data/features/docs/formatters/json_formatter.feature +51 -4
  9. data/features/docs/formatters/junit_formatter.feature +1 -0
  10. data/features/docs/gherkin/outlines.feature +4 -0
  11. data/features/docs/output_from_hooks.feature +128 -0
  12. data/features/docs/wire_protocol_table_diffing.feature +6 -2
  13. data/features/docs/writing_support_code/after_hooks.feature +56 -0
  14. data/lib/cucumber/cli/configuration.rb +0 -4
  15. data/lib/cucumber/cli/main.rb +0 -1
  16. data/lib/cucumber/cli/options.rb +0 -3
  17. data/lib/cucumber/formatter/console.rb +3 -1
  18. data/lib/cucumber/formatter/debug.rb +4 -0
  19. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +26 -3
  20. data/lib/cucumber/formatter/html.rb +6 -2
  21. data/lib/cucumber/formatter/usage.rb +1 -58
  22. data/lib/cucumber/mappings.rb +25 -7
  23. data/lib/cucumber/multiline_argument.rb +40 -82
  24. data/lib/cucumber/multiline_argument/data_table.rb +719 -0
  25. data/lib/cucumber/multiline_argument/doc_string.rb +10 -0
  26. data/lib/cucumber/platform.rb +1 -1
  27. data/lib/cucumber/rb_support/rb_world.rb +2 -4
  28. data/lib/cucumber/reports/legacy_formatter.rb +69 -22
  29. data/lib/cucumber/runtime.rb +0 -39
  30. data/lib/cucumber/runtime/for_programming_languages.rb +12 -10
  31. data/lib/cucumber/runtime/support_code.rb +11 -4
  32. data/lib/cucumber/wire_support/wire_protocol/requests.rb +2 -2
  33. data/spec/cucumber/formatter/pretty_spec.rb +5 -5
  34. data/spec/cucumber/mappings_spec.rb +137 -8
  35. data/spec/cucumber/multiline_argument/data_table_spec.rb +508 -0
  36. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +3 -3
  37. data/spec/cucumber/rb_support/snippet_spec.rb +1 -1
  38. data/spec/cucumber/runtime/for_programming_languages_spec.rb +16 -12
  39. metadata +13 -6
  40. data/lib/cucumber/runtime/features_loader.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec39cd25b8f17917a20fd5af809119a9ecad0671
4
- data.tar.gz: 43aced438654c8263f00185586f45c42daeedab0
3
+ metadata.gz: 1b115e5b0a7ae23e6b0372462a320314ee144811
4
+ data.tar.gz: 3143905ef42ea795c85cc6163dedf95bd670f582
5
5
  SHA512:
6
- metadata.gz: 8b7126a89b0f2e88fc81dfbd3aebf4998928f8f49033ba67a453a74525234b1d73f811aba9346bafe2c0274fbc6cc8b4deb45c5a0a4411e54cbf47c3e5ece726
7
- data.tar.gz: 4c81bc4dd772677dc1888a4da72eaf8401093440274faac071beb52f9dc320e481e6b34735486aec2e3c3b914d9096e3b273591265e379082447efa0f288a9d1
6
+ metadata.gz: 1144b0d0bdf707e16db0b4d389aa7242f870df050db0da4ffe6c749e26309dfbd0bec80eb3db5995c27456e8cddd610bcb242d4a407a3a5887a0933c510e2744
7
+ data.tar.gz: dcfa6d1ca0b6af5abb794495a6872509976519c40af52075f78056593dfde8d397e10ae7d67ae3f2aa710ac2a6401aaca6c481747033d38d8d35c911f20acb08
data/History.md CHANGED
@@ -1,12 +1,29 @@
1
- ## [In Git](https://github.com/cucumber/cucumber/compare/v.2.0.0.beta.1...master)
1
+ ## [In Git](https://github.com/cucumber/cucumber/compare/v.2.0.0.beta.2...master)
2
2
 
3
- ### Bugfixes
3
+ ### Removed Features
4
4
 
5
- * Better reporting of exceptions in Before / After hooks ([723](https://github.com/cucumber/cucumber/pull/723) @mattwynne)
5
+ * The `--dotcucumber` option is no longer supported and `stepdefs.json` is no longer written. (Aslak Hellesøy)
6
6
 
7
- ### New features
7
+ ### New Features
8
+
9
+ * Include both outline step and expanded step in error backtrace ([730](https://github.com/cucumber/cucumber/pull/730) @brasmusson)
10
+ * Add TestCase#outline? for conditionals in Before / After hooks ([728](https://github.com/cucumber/cucumber/pull/728) [Erran Carey](https://github.com/erran))
11
+ * Support embedding images directly in HTML and JSON reports ([696](https://github.com/cucumber/cucumber/pull/696),[695](https://github.com/cucumber/cucumber/pull/695/files) @brasmusson)
8
12
 
9
- * Support embedding images directly in HTML and JSON reports ([696](https://github.com/cucumber/cucumber/pull/696),[695](https://github.com/cucumber/cucumber/pull/695/files) @brasmusson)
13
+ ### Bugfixes
14
+
15
+ * Pass hook output to the formatters appropriately ([732](https://github.com/cucumber/cucumber/pull/732) @brasmusson)
16
+ * Added tests for, and re-added behaviour to support Scenario#failed? in hooks (Matt Wynne)
17
+ * Rescuing ArgumentError in HTML formatter so Cucumber won't stop tests due bad encoding ([690](https://github.com/cucumber/cucumber/pull/690) @awls99)
18
+ * Add back support for the DataTable API ([729](https://github.com/cucumber/cucumber/pull/729) @mattwynne and @tooky)
19
+ * Fix Windows support loading files properly ([739](https://github.com/cucumber/cucumber/issues/739) @os97673)
20
+
21
+ ## [v2.0.0.beta.2](https://github.com/cucumber/cucumber/compare/v.2.0.0.beta.1...v.2.0.0.beta.2)
22
+
23
+ ### Bugfixes
24
+
25
+ * Better reporting of exceptions in Before / After hooks ([723](https://github.com/cucumber/cucumber/pull/723) @mattwynne)
26
+ * Add `#source_tag_names` method to `TestCase` object passed to hooks (@mattwynne)
10
27
 
11
28
  ## [v2.0.0.beta.1 ](https://github.com/cucumber/cucumber/compare/v1.3.8...v.2.0.0.beta.1)
12
29
 
@@ -22,8 +39,8 @@ all.
22
39
 
23
40
  * Better snippet comment ([579](https://github.com/cucumber/cucumber/pull/579) Jeff Nyman)
24
41
  * Random scenario ordering with `--order random`
25
- * Embed plain text ([712](https://github.com/cucumber/cucumber/pull/712) @bingwei
26
- * Support the cucumber-reporting tools also when using Scenario Outlines ([700](https://github.com/cucumber/cucumber/pull/700) @brasmusson
42
+ * Embed plain text ([712](https://github.com/cucumber/cucumber/pull/712) @bingwei)
43
+ * Support the cucumber-reporting tools also when using Scenario Outlines ([700](https://github.com/cucumber/cucumber/pull/700) @brasmusson)
27
44
 
28
45
  ### Features removed
29
46
 
@@ -45,6 +62,7 @@ all.
45
62
 
46
63
  ## [v1.3.16](https://github.com/cucumber/cucumber/compare/v1.3.15...v1.3.16)
47
64
 
65
+ * Pass output from the step definition on to the JSON formatter ([701](https://github.com/cucumber/cucumber/pull/701) @brasmusson)
48
66
  * Add RSpec 3 test double support ([689](https://github.com/cucumber/cucumber/pull/689) @cyphactor)
49
67
  * Fix bug with rerun formatter and `--expand` option ([710](https://github.com/cucumber/cucumber/pull/710) @brasmusson)
50
68
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.platform = Gem::Platform::RUBY
15
15
  s.required_ruby_version = ">= 1.9.3"
16
16
 
17
- s.add_dependency 'cucumber-core', '~> 1.0.0.beta.2'
17
+ s.add_dependency 'cucumber-core', '~> 1.0.0.beta.3'
18
18
  s.add_dependency 'builder', '>= 2.1.2'
19
19
  s.add_dependency 'diff-lcs', '>= 1.1.3'
20
20
  s.add_dependency 'gherkin', '~> 2.12'
@@ -1,6 +1,5 @@
1
1
  Feature: Nested Steps
2
2
 
3
-
4
3
  Background:
5
4
  Given a scenario with a step that looks like this:
6
5
  """gherkin
@@ -121,6 +121,7 @@ Feature: Pretty formatter - Printing messages
121
121
  | 1 | anno1 | fail | Line: 1: anno1
122
122
  (RuntimeError)
123
123
  ./features/step_definitions/puts_steps.rb:13:in `/^I use message (.+) in line (.+) (?:with result (.+))$/'
124
+ features/f.feature:29:in `Given I use message anno1 in line 1 with result fail'
124
125
  features/f.feature:25:in `Given I use message <ann> in line <line> with result <result>'
125
126
  | 2 | anno2 | pass | Line: 2: anno2
126
127
  """
@@ -22,8 +22,8 @@ Feature: Table diffing
22
22
  }))
23
23
  end
24
24
  """
25
- When I run `cucumber -i features/tables.feature`
26
- Then it should fail with:
25
+ When I run `cucumber features/tables.feature`
26
+ Then it should fail with exactly:
27
27
  """
28
28
  Feature: Tables
29
29
 
@@ -31,8 +31,12 @@ Feature: Table diffing
31
31
  Then the table should be: # features/step_definitions/steps.rb:1
32
32
  | x | y |
33
33
  | a | b |
34
- | a | c |
35
- Tables were not identical (Cucumber::MultilineArgument::DataTable::Different)
34
+ Tables were not identical:
35
+
36
+ | x | y |
37
+ | (-) a | (-) b |
38
+ | (+) a | (+) c |
39
+ (Cucumber::MultilineArgument::DataTable::Different)
36
40
  ./features/step_definitions/steps.rb:2:in `/the table should be:/'
37
41
  features/tables.feature:3:in `Then the table should be:'
38
42
 
@@ -41,5 +45,6 @@ Feature: Table diffing
41
45
 
42
46
  1 scenario (1 failed)
43
47
  1 step (1 failed)
48
+ 0m0.012s
44
49
 
45
50
  """
@@ -86,6 +86,7 @@ Feature: Exception in AfterStep Block
86
86
  | does something naughty |
87
87
  This step has been very very naughty (NaughtyStepException)
88
88
  ./features/support/env.rb:4:in `AfterStep'
89
+ features/naughty_step_in_scenario_outline.feature:9:in `Given this step does something naughty'
89
90
  features/naughty_step_in_scenario_outline.feature:4:in `Given this step <Might Work>'
90
91
  | passes |
91
92
 
@@ -83,6 +83,17 @@ Feature: JSON output formatter
83
83
  Given I embed data directly
84
84
 
85
85
  """
86
+ And a file named "features/out_scenario_out_scenario_outline.feature" with:
87
+ """
88
+ Feature:
89
+ Scenario:
90
+ Given this step passes
91
+ Scenario Outline:
92
+ Given this step <status>
93
+ Examples:
94
+ | status |
95
+ | passes |
96
+ """
86
97
 
87
98
  # Need to investigate why this won't pass in-process. error_message doesn't get det?
88
99
  @spawn
@@ -538,7 +549,7 @@ Feature: JSON output formatter
538
549
  {
539
550
  "keyword": "Given ",
540
551
  "name": "this step passes",
541
- "line": 4,
552
+ "line": 8,
542
553
  "match": {
543
554
  "location": "features/step_definitions/steps.rb:1"
544
555
  },
@@ -560,13 +571,13 @@ Feature: JSON output formatter
560
571
  {
561
572
  "keyword": "Given ",
562
573
  "name": "this step fails",
563
- "line": 4,
574
+ "line": 9,
564
575
  "match": {
565
576
  "location": "features/step_definitions/steps.rb:4"
566
577
  },
567
578
  "result": {
568
579
  "status": "failed",
569
- "error_message" : " (RuntimeError)\n./features/step_definitions/steps.rb:4:in `/^this step fails$/'\nfeatures/outline.feature:4:in `Given this step <status>'",
580
+ "error_message" : " (RuntimeError)\n./features/step_definitions/steps.rb:4:in `/^this step fails$/'\nfeatures/outline.feature:9:in `Given this step fails'\nfeatures/outline.feature:4:in `Given this step <status>'",
570
581
  "duration": 1
571
582
  }
572
583
  }
@@ -583,7 +594,7 @@ Feature: JSON output formatter
583
594
  {
584
595
  "keyword": "Given ",
585
596
  "name": "this step passes",
586
- "line": 4,
597
+ "line": 13,
587
598
  "match": {
588
599
  "location": "features/step_definitions/steps.rb:1"
589
600
  },
@@ -647,3 +658,39 @@ Feature: JSON output formatter
647
658
  ]
648
659
 
649
660
  """
661
+ @spawn
662
+ Scenario: handle output from hooks
663
+ Given a file named "features/step_definitions/output_steps.rb" with:
664
+ """
665
+ Before do
666
+ puts "Before hook 1"
667
+ embed "src", "mime_type", "label"
668
+ end
669
+
670
+ Before do
671
+ puts "Before hook 2"
672
+ embed "src", "mime_type", "label"
673
+ end
674
+
675
+ AfterStep do
676
+ puts "AfterStep hook 1"
677
+ embed "src", "mime_type", "label"
678
+ end
679
+
680
+ AfterStep do
681
+ puts "AfterStep hook 2"
682
+ embed "src", "mime_type", "label"
683
+ end
684
+
685
+ After do
686
+ puts "After hook 1"
687
+ embed "src", "mime_type", "label"
688
+ end
689
+
690
+ After do
691
+ puts "After hook 2"
692
+ embed "src", "mime_type", "label"
693
+ end
694
+ """
695
+ When I run `cucumber --format json features/out_scenario_out_scenario_outline.feature`
696
+ Then it should pass
@@ -259,6 +259,7 @@ You *must* specify --out DIR for the junit formatter
259
259
  ]]>
260
260
  <![CDATA[ (RuntimeError)
261
261
  ./features/step_definitions/steps.rb:4:in `/^this step fails$/'
262
+ features/scenario_outline.feature:9:in `Given this step fails'
262
263
  features/scenario_outline.feature:4:in `Given this step <type>']]>
263
264
  </failure>
264
265
  <system-out/>
@@ -62,6 +62,7 @@ Feature: Scenario outlines
62
62
  | failing | passing |
63
63
  RuntimeError (RuntimeError)
64
64
  ./features/step_definitions/steps.rb:2:in `/^failing without a table$/'
65
+ features/outline_sample.feature:12:in `Given failing without a table'
65
66
  features/outline_sample.feature:6:in `Given <state> without a table'
66
67
 
67
68
  Examples: Only passing
@@ -92,6 +93,7 @@ Feature: Scenario outlines
92
93
  | failing | passing |
93
94
  RuntimeError (RuntimeError)
94
95
  ./features/step_definitions/steps.rb:2:in `/^failing without a table$/'
96
+ features/outline_sample.feature:12:in `Given failing without a table'
95
97
  features/outline_sample.feature:6:in `Given <state> without a table'
96
98
 
97
99
  Examples: Only passing
@@ -121,6 +123,7 @@ Feature: Scenario outlines
121
123
  | failing | passing |
122
124
  RuntimeError (RuntimeError)
123
125
  ./features/step_definitions/steps.rb:2:in `/^failing without a table$/'
126
+ features/outline_sample.feature:12:in `Given failing without a table'
124
127
  features/outline_sample.feature:6:in `Given <state> without a table'
125
128
 
126
129
  Failing Scenarios:
@@ -141,6 +144,7 @@ Feature: Scenario outlines
141
144
 
142
145
  RuntimeError (RuntimeError)
143
146
  ./features/step_definitions/steps.rb:2:in `/^failing without a table$/'
147
+ features/outline_sample.feature:12:in `Given failing without a table'
144
148
  features/outline_sample.feature:6:in `Given <state> without a table'
145
149
 
146
150
  Failing Scenarios:
@@ -0,0 +1,128 @@
1
+ Feature: Hook output feature
2
+
3
+ Calls to puts and embed in hook, should be passed to the formatters.
4
+
5
+ Background:
6
+ Given the standard step definitions
7
+
8
+ Scenario: Output from hooks
9
+ Given a file named "features/test.feature" with:
10
+ """
11
+ Feature:
12
+ Scenario:
13
+ Given this step passes
14
+ Scenario Outline:
15
+ Given this step <status>
16
+ Examples:
17
+ | status |
18
+ | passes |
19
+ """
20
+ And a file named "features/step_definitions/output_steps.rb" with:
21
+ """
22
+ Before do
23
+ puts "Before hook 1"
24
+ embed "src", "mime_type", "label"
25
+ end
26
+
27
+ Before do
28
+ puts "Before hook 2"
29
+ embed "src", "mime_type", "label"
30
+ end
31
+
32
+ AfterStep do
33
+ puts "AfterStep hook 1"
34
+ embed "src", "mime_type", "label"
35
+ end
36
+
37
+ AfterStep do
38
+ puts "AfterStep hook 2"
39
+ embed "src", "mime_type", "label"
40
+ end
41
+
42
+ After do
43
+ puts "After hook 1"
44
+ embed "src", "mime_type", "label"
45
+ end
46
+
47
+ After do
48
+ puts "After hook 2"
49
+ embed "src", "mime_type", "label"
50
+ end
51
+ """
52
+ When I run `cucumber -f debug`
53
+ Then the stderr should not contain anything
54
+ Then it should pass with:
55
+ """
56
+ before_features
57
+ before_feature
58
+ before_tags
59
+ after_tags
60
+ feature_name
61
+ before_feature_element
62
+ before_tags
63
+ after_tags
64
+ scenario_name
65
+ puts
66
+ embed
67
+ puts
68
+ embed
69
+ before_steps
70
+ before_step
71
+ before_step_result
72
+ step_name
73
+ after_step_result
74
+ after_step
75
+ puts
76
+ embed
77
+ puts
78
+ embed
79
+ after_steps
80
+ puts
81
+ embed
82
+ puts
83
+ embed
84
+ after_feature_element
85
+ before_feature_element
86
+ before_tags
87
+ after_tags
88
+ scenario_name
89
+ before_steps
90
+ before_step
91
+ before_step_result
92
+ step_name
93
+ after_step_result
94
+ after_step
95
+ after_steps
96
+ before_examples_array
97
+ before_examples
98
+ examples_name
99
+ before_outline_table
100
+ before_table_row
101
+ before_table_cell
102
+ table_cell_value
103
+ after_table_cell
104
+ after_table_row
105
+ puts
106
+ embed
107
+ puts
108
+ embed
109
+ before_table_row
110
+ before_table_cell
111
+ table_cell_value
112
+ after_table_cell
113
+ after_table_row
114
+ puts
115
+ embed
116
+ puts
117
+ embed
118
+ puts
119
+ embed
120
+ puts
121
+ embed
122
+ after_outline_table
123
+ after_examples
124
+ after_examples_array
125
+ after_feature_element
126
+ after_feature
127
+ after_features
128
+ """
@@ -103,13 +103,16 @@ Feature: Wire protocol table diffing
103
103
  | ["invoke",{"id":"1","args":[]}] | ["diff!",[[["a"]],[["b"]]]] |
104
104
  | ["end_scenario"] | ["success"] |
105
105
  When I run `cucumber -f progress`
106
- And it should fail with:
106
+ And it should fail with exactly:
107
107
  """
108
108
  F
109
109
 
110
110
  (::) failed steps (::)
111
111
 
112
- Tables were not identical (Cucumber::MultilineArgument::DataTable::Different)
112
+ Tables were not identical:
113
+
114
+ | (-) a | (+) b |
115
+ (Cucumber::MultilineArgument::DataTable::Different)
113
116
  features/wired.feature:3:in `Given we're all wired'
114
117
 
115
118
  Failing Scenarios:
@@ -117,5 +120,6 @@ Feature: Wire protocol table diffing
117
120
 
118
121
  1 scenario (1 failed)
119
122
  1 step (1 failed)
123
+ 0m0.012s
120
124
 
121
125
  """
@@ -0,0 +1,56 @@
1
+ Feature: After Hooks
2
+
3
+ After hooks can be used to clean up any state you've altered during your
4
+ scenario, or to check the status of the scenario and act accordingly.
5
+
6
+ You can ask a scenario whether it has failed, for example.
7
+
8
+ Mind you, even if it hasn't failed yet, you can still make the scenario
9
+ fail if your After hook throws an error.
10
+
11
+ Background:
12
+ Given the standard step definitions
13
+
14
+ Scenario: Check the failed status of a scenario in a hook
15
+ Given a file named "features/support/debug_hook.rb" with:
16
+ """
17
+ After do |scenario|
18
+ if scenario.failed?
19
+ puts "eek"
20
+ end
21
+ end
22
+ """
23
+ And a file named "features/fail.feature" with:
24
+ """
25
+ Feature:
26
+ Scenario:
27
+ Given this step fails
28
+ """
29
+ When I run `cucumber -f progress`
30
+ Then the output should contain:
31
+ """
32
+ eek
33
+ """
34
+
35
+ Scenario: Make a scenario fail from an After hook
36
+ Given a file named "features/support/bad_hook.rb" with:
37
+ """
38
+ After do
39
+ fail 'yikes'
40
+ end
41
+ """
42
+ And a file named "features/pass.feature" with:
43
+ """
44
+ Feature:
45
+ Scenario:
46
+ Given this step passes
47
+ """
48
+ When I run `cucumber -f pretty`
49
+ Then it should fail with:
50
+ """
51
+ Scenario: # features/pass.feature:2
52
+ Given this step passes # features/step_definitions/steps.rb:1
53
+ yikes (RuntimeError)
54
+ ./features/support/bad_hook.rb:2:in `After'
55
+ """
56
+