cucumber-instafail 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cucumber-instafail.gemspec +1 -1
- data/lib/cucumber/instafail.rb +16 -1
- data/lib/cucumber/instafail/version.rb +2 -2
- data/spec/cucumber/instafail_spec.rb +172 -0
- data/spec/support/cucumber_spec_helper.rb +39 -41
- metadata +3 -4
- data/lib/cucumber/instafail/formatter/progress_instafail.rb +0 -19
- data/spec/cucumber/instafail/formatter/progress_instafail_spec.rb +0 -174
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98e51363e22c555ab09983e4548731bbaf0b2b10
|
4
|
+
data.tar.gz: 3268735dffbd14780dd901b18fa0b0322a2503af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d159f096b3e7565baeb9f02e55795f9fb5af195201cf3e7a969fb4d412f5bb29719c14d0e37e5c5c1acf56937848b975d941974e125737e670ef5472ae72ce32
|
7
|
+
data.tar.gz: c5c4ccfcbc4ba16c904807aa66c9c811fc7f88050852fad5557d904d3b700b558233411a2da1a21281e1d150469174504f8207c20d4990e3876d932407f48311
|
data/cucumber-instafail.gemspec
CHANGED
data/lib/cucumber/instafail.rb
CHANGED
@@ -1,2 +1,17 @@
|
|
1
|
-
require 'cucumber/
|
1
|
+
require 'cucumber/formatter/progress'
|
2
2
|
require 'cucumber/instafail/version'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
# The formatter used for <tt>--format Cucumber::Instafail</tt>
|
6
|
+
class Instafail < Cucumber::Formatter::Progress
|
7
|
+
def progress(status)
|
8
|
+
char = CHARS[status]
|
9
|
+
@io.print(format_string(char, status))
|
10
|
+
if status == :failed
|
11
|
+
last_failed = runtime.steps(:failed).last
|
12
|
+
print_elements(Array(last_failed), status, 'steps')
|
13
|
+
end
|
14
|
+
@io.flush
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'cucumber/instafail'
|
3
|
+
require 'support/cucumber_spec_helper'
|
4
|
+
require 'cucumber/cli/main'
|
5
|
+
require 'cucumber/instafail'
|
6
|
+
|
7
|
+
module Cucumber
|
8
|
+
describe Instafail do
|
9
|
+
extend SpecHelperDsl
|
10
|
+
include SpecHelper
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
Cucumber::Term::ANSIColor.coloring = false
|
14
|
+
@out = StringIO.new
|
15
|
+
@options = Cucumber::Cli::Options.new
|
16
|
+
@formatter = Instafail.new(step_mother, @out, @options)
|
17
|
+
run_defined_feature
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with a single passing scenario' do
|
21
|
+
define_feature <<-FEATURE
|
22
|
+
Feature: Banana party
|
23
|
+
|
24
|
+
Scenario: Monkey eats banana
|
25
|
+
Given there are bananas
|
26
|
+
FEATURE
|
27
|
+
|
28
|
+
define_steps do
|
29
|
+
Given(/^there are bananas$/) { }
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'outputs the passed step' do
|
33
|
+
expect(@out.string).to include ".\n"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with a single failing scenario' do
|
38
|
+
define_feature <<-FEATURE
|
39
|
+
Feature: Banana party
|
40
|
+
|
41
|
+
Scenario: Monkey eats banana
|
42
|
+
Given there are bananas
|
43
|
+
FEATURE
|
44
|
+
|
45
|
+
define_steps do
|
46
|
+
Given(/^there are bananas$/) do
|
47
|
+
raise 'Unable to create the bananas'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'outputs the failed step' do
|
52
|
+
expect(@out.string).to include "F(::) failed steps (::)\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'outputs the error "Unable to create the bananas (RuntimeError)"' do
|
56
|
+
message = 'Unable to create the bananas (RuntimeError)'
|
57
|
+
expect(@out.string).to include message
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should have 1 scenario and 1 failure' do
|
61
|
+
expect(@out.string).to include '1 scenario (1 failed)'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'with multiple scenarios' do
|
66
|
+
context 'and one failure' do
|
67
|
+
define_feature <<-FEATURE
|
68
|
+
Feature: Banana party
|
69
|
+
|
70
|
+
Scenario: Monkey eats banana
|
71
|
+
Given there are bananas
|
72
|
+
When he eats the bananas
|
73
|
+
Then the monkey should be happy
|
74
|
+
|
75
|
+
Scenario: Gorilla eats banana
|
76
|
+
Given there are bananas
|
77
|
+
When he eats the bananas
|
78
|
+
Then the gorilla should be happy
|
79
|
+
|
80
|
+
Scenario: Lion eats banana
|
81
|
+
Given there are bananas
|
82
|
+
When he eats the bananas
|
83
|
+
Then the lion should be happy
|
84
|
+
|
85
|
+
FEATURE
|
86
|
+
|
87
|
+
define_steps do
|
88
|
+
Given(/^there are bananas$/) { }
|
89
|
+
When(/^he eats the bananas$/) { }
|
90
|
+
Then(/^the (?:monkey|lion) should be happy$/) { }
|
91
|
+
Then(/^the gorilla should be happy$/) do
|
92
|
+
raise 'The Gorilla is unhappy : ('
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'outputs the failed step' do
|
97
|
+
expect(@out.string).to include "F(::) failed steps (::)\n"
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'outputs the error "The Gorilla is unhappy : ( (RuntimeError)"' do
|
101
|
+
message = 'The Gorilla is unhappy : ( (RuntimeError)'
|
102
|
+
expect(@out.string).to include message
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should have 3 scenarios, 1 failure and 2 passed' do
|
106
|
+
expect(@out.string).to include '3 scenarios (1 failed, 2 passed)'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
context 'and multiple failures' do
|
110
|
+
define_feature <<-FEATURE
|
111
|
+
Feature: Banana party
|
112
|
+
|
113
|
+
Scenario: Monkey eats banana
|
114
|
+
Given there are bananas
|
115
|
+
When he eats the bananas
|
116
|
+
Then the monkey should be happy
|
117
|
+
|
118
|
+
Scenario: Gorilla eats banana
|
119
|
+
Given there are bananas
|
120
|
+
When he eats the bananas
|
121
|
+
Then the gorilla should be happy
|
122
|
+
|
123
|
+
Scenario: Lion eats banana
|
124
|
+
Given there are bananas
|
125
|
+
When he eats the bananas
|
126
|
+
Then the lion should be happy
|
127
|
+
|
128
|
+
FEATURE
|
129
|
+
|
130
|
+
define_steps do
|
131
|
+
Given(/^there are bananas$/) { }
|
132
|
+
When(/^he eats the bananas$/) { }
|
133
|
+
Then(/^the monkey should be happy$/) { }
|
134
|
+
Then(/^the gorilla should be happy$/) do
|
135
|
+
raise 'The Gorilla is unhappy : ('
|
136
|
+
end
|
137
|
+
Then(/^the lion should be happy$/) do
|
138
|
+
raise 'The Lion is unhappy too'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'outputs the failed step' do
|
143
|
+
expect(@out.string).to include "F(::) failed steps (::)\n"
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'outputs the error "The Gorilla is unhappy : ( (RuntimeError)"' do
|
147
|
+
message = 'The Gorilla is unhappy : ( (RuntimeError)'
|
148
|
+
expect(@out.string).to include message
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'outputs the error "The Lion is unhappy : ( (RuntimeError)"' do
|
152
|
+
message = 'The Lion is unhappy too (RuntimeError)'
|
153
|
+
expect(@out.string).to include message
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'should have 3 scenarios, 2 failures and 1 passed' do
|
157
|
+
expect(@out.string).to include '3 scenarios (2 failed, 1 passed)'
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should not display duplicates' do
|
161
|
+
header = "F(::) failed steps (::)\n\n"
|
162
|
+
|
163
|
+
expected = "#{header}The Gorilla is unhappy : ( (RuntimeError)"
|
164
|
+
expect(@out.string).to include expected
|
165
|
+
|
166
|
+
expected = "#{header}The Lion is unhappy too (RuntimeError)"
|
167
|
+
expect(@out.string).to include expected
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -1,53 +1,51 @@
|
|
1
1
|
module Cucumber
|
2
|
-
module
|
3
|
-
|
4
|
-
attr_reader :feature_content, :step_defs, :feature_filename
|
2
|
+
module SpecHelperDsl
|
3
|
+
attr_reader :feature_content, :step_defs, :feature_filename
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
def define_feature(string, feature_file = 'spec.feature')
|
6
|
+
@feature_content = string
|
7
|
+
@feature_filename = feature_file
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
10
|
+
def define_steps(&block)
|
11
|
+
@step_defs = block
|
14
12
|
end
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
module SpecHelper
|
16
|
+
def run_defined_feature
|
17
|
+
define_steps
|
18
|
+
features = load_features(self.class.feature_content ||
|
19
|
+
raise('No feature content defined!'))
|
20
|
+
run(features)
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def step_mother
|
24
|
+
@step_mother ||= Runtime.new
|
25
|
+
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
def load_features(content)
|
28
|
+
feature_file = FeatureFile.new(self.class.feature_filename, content)
|
29
|
+
features = Ast::Features.new
|
30
|
+
filters = []
|
31
|
+
feature = feature_file.parse(filters, {})
|
32
|
+
features.add_feature(feature) if feature
|
33
|
+
features
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
def run(features)
|
37
|
+
configuration = Cucumber::Configuration.default
|
38
|
+
tree_walker = Cucumber::Ast::TreeWalker.new(step_mother, [@formatter],
|
39
|
+
configuration)
|
40
|
+
tree_walker.visit_features(features)
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
43
|
+
def define_steps
|
44
|
+
return unless step_defs = self.class.step_defs
|
45
|
+
rb = step_mother.load_programming_language('rb')
|
46
|
+
dsl = Object.new
|
47
|
+
dsl.extend RbSupport::RbDsl
|
48
|
+
dsl.instance_exec &step_defs
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-instafail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Hain
|
@@ -110,9 +110,8 @@ files:
|
|
110
110
|
- Rakefile
|
111
111
|
- cucumber-instafail.gemspec
|
112
112
|
- lib/cucumber/instafail.rb
|
113
|
-
- lib/cucumber/instafail/formatter/progress_instafail.rb
|
114
113
|
- lib/cucumber/instafail/version.rb
|
115
|
-
- spec/cucumber/
|
114
|
+
- spec/cucumber/instafail_spec.rb
|
116
115
|
- spec/spec_helper.rb
|
117
116
|
- spec/support/cucumber_spec_helper.rb
|
118
117
|
homepage: https://github.com/zedtux/cucumber-instafail
|
@@ -140,6 +139,6 @@ signing_key:
|
|
140
139
|
specification_version: 4
|
141
140
|
summary: Show failing features instantly
|
142
141
|
test_files:
|
143
|
-
- spec/cucumber/
|
142
|
+
- spec/cucumber/instafail_spec.rb
|
144
143
|
- spec/spec_helper.rb
|
145
144
|
- spec/support/cucumber_spec_helper.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/console'
|
2
|
-
require 'cucumber/formatter/io'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Formatter
|
6
|
-
# The formatter used for <tt>--format progress-instafail</tt>
|
7
|
-
class ProgressInstafail < Cucumber::Formatter::Progress
|
8
|
-
def progress(status)
|
9
|
-
char = CHARS[status]
|
10
|
-
@io.print(format_string(char, status))
|
11
|
-
if status == :failed
|
12
|
-
last_failed = runtime.steps(:failed).last
|
13
|
-
print_elements(Array(last_failed), status, 'steps')
|
14
|
-
end
|
15
|
-
@io.flush
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,174 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'cucumber/formatter/progress'
|
3
|
-
require 'support/cucumber_spec_helper'
|
4
|
-
require 'cucumber/cli/main'
|
5
|
-
require 'cucumber/instafail/formatter/progress_instafail'
|
6
|
-
|
7
|
-
module Cucumber
|
8
|
-
module Formatter
|
9
|
-
describe ProgressInstafail do
|
10
|
-
extend SpecHelperDsl
|
11
|
-
include SpecHelper
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
Cucumber::Term::ANSIColor.coloring = false
|
15
|
-
@out = StringIO.new
|
16
|
-
@options = Cucumber::Cli::Options.new
|
17
|
-
@formatter = ProgressInstafail.new(step_mother, @out, @options)
|
18
|
-
run_defined_feature
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with a single passing scenario' do
|
22
|
-
define_feature <<-FEATURE
|
23
|
-
Feature: Banana party
|
24
|
-
|
25
|
-
Scenario: Monkey eats banana
|
26
|
-
Given there are bananas
|
27
|
-
FEATURE
|
28
|
-
|
29
|
-
define_steps do
|
30
|
-
Given(/^there are bananas$/) { }
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'outputs the passed step' do
|
34
|
-
expect(@out.string).to include ".\n"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'with a single failing scenario' do
|
39
|
-
define_feature <<-FEATURE
|
40
|
-
Feature: Banana party
|
41
|
-
|
42
|
-
Scenario: Monkey eats banana
|
43
|
-
Given there are bananas
|
44
|
-
FEATURE
|
45
|
-
|
46
|
-
define_steps do
|
47
|
-
Given(/^there are bananas$/) do
|
48
|
-
raise 'Unable to create the bananas'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'outputs the failed step' do
|
53
|
-
expect(@out.string).to include "F(::) failed steps (::)\n"
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'outputs the error "Unable to create the bananas (RuntimeError)"' do
|
57
|
-
message = 'Unable to create the bananas (RuntimeError)'
|
58
|
-
expect(@out.string).to include message
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'should have 1 scenario and 1 failure' do
|
62
|
-
expect(@out.string).to include '1 scenario (1 failed)'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'with multiple scenarios' do
|
67
|
-
context 'and one failure' do
|
68
|
-
define_feature <<-FEATURE
|
69
|
-
Feature: Banana party
|
70
|
-
|
71
|
-
Scenario: Monkey eats banana
|
72
|
-
Given there are bananas
|
73
|
-
When he eats the bananas
|
74
|
-
Then the monkey should be happy
|
75
|
-
|
76
|
-
Scenario: Gorilla eats banana
|
77
|
-
Given there are bananas
|
78
|
-
When he eats the bananas
|
79
|
-
Then the gorilla should be happy
|
80
|
-
|
81
|
-
Scenario: Lion eats banana
|
82
|
-
Given there are bananas
|
83
|
-
When he eats the bananas
|
84
|
-
Then the lion should be happy
|
85
|
-
|
86
|
-
FEATURE
|
87
|
-
|
88
|
-
define_steps do
|
89
|
-
Given(/^there are bananas$/) { }
|
90
|
-
When(/^he eats the bananas$/) { }
|
91
|
-
Then(/^the (?:monkey|lion) should be happy$/) { }
|
92
|
-
Then(/^the gorilla should be happy$/) do
|
93
|
-
raise 'The Gorilla is unhappy : ('
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'outputs the failed step' do
|
98
|
-
expect(@out.string).to include "F(::) failed steps (::)\n"
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'outputs the error "The Gorilla is unhappy : ( (RuntimeError)"' do
|
102
|
-
message = 'The Gorilla is unhappy : ( (RuntimeError)'
|
103
|
-
expect(@out.string).to include message
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'should have 3 scenarios, 1 failure and 2 passed' do
|
107
|
-
expect(@out.string).to include '3 scenarios (1 failed, 2 passed)'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
context 'and multiple failures' do
|
111
|
-
define_feature <<-FEATURE
|
112
|
-
Feature: Banana party
|
113
|
-
|
114
|
-
Scenario: Monkey eats banana
|
115
|
-
Given there are bananas
|
116
|
-
When he eats the bananas
|
117
|
-
Then the monkey should be happy
|
118
|
-
|
119
|
-
Scenario: Gorilla eats banana
|
120
|
-
Given there are bananas
|
121
|
-
When he eats the bananas
|
122
|
-
Then the gorilla should be happy
|
123
|
-
|
124
|
-
Scenario: Lion eats banana
|
125
|
-
Given there are bananas
|
126
|
-
When he eats the bananas
|
127
|
-
Then the lion should be happy
|
128
|
-
|
129
|
-
FEATURE
|
130
|
-
|
131
|
-
define_steps do
|
132
|
-
Given(/^there are bananas$/) { }
|
133
|
-
When(/^he eats the bananas$/) { }
|
134
|
-
Then(/^the monkey should be happy$/) { }
|
135
|
-
Then(/^the gorilla should be happy$/) do
|
136
|
-
raise 'The Gorilla is unhappy : ('
|
137
|
-
end
|
138
|
-
Then(/^the lion should be happy$/) do
|
139
|
-
raise 'The Lion is unhappy too'
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'outputs the failed step' do
|
144
|
-
expect(@out.string).to include "F(::) failed steps (::)\n"
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'outputs the error "The Gorilla is unhappy : ( (RuntimeError)"' do
|
148
|
-
message = 'The Gorilla is unhappy : ( (RuntimeError)'
|
149
|
-
expect(@out.string).to include message
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'outputs the error "The Lion is unhappy : ( (RuntimeError)"' do
|
153
|
-
message = 'The Lion is unhappy too (RuntimeError)'
|
154
|
-
expect(@out.string).to include message
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'should have 3 scenarios, 2 failures and 1 passed' do
|
158
|
-
expect(@out.string).to include '3 scenarios (2 failed, 1 passed)'
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'should not display duplicates' do
|
162
|
-
header = "F(::) failed steps (::)\n\n"
|
163
|
-
|
164
|
-
expected = "#{header}The Gorilla is unhappy : ( (RuntimeError)"
|
165
|
-
expect(@out.string).to include expected
|
166
|
-
|
167
|
-
expected = "#{header}The Lion is unhappy too (RuntimeError)"
|
168
|
-
expect(@out.string).to include expected
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|