ugly_face 0.6 → 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +5 -2
- data/lib/ugly_face/.DS_Store +0 -0
- data/lib/ugly_face/formatter/html.rb +17 -16
- data/lib/ugly_face/formatter/report.rb +24 -19
- data/lib/ugly_face/formatter/view_helper.rb +5 -3
- data/lib/ugly_face/templates/_step.erb +17 -12
- data/lib/ugly_face/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdf4fc5ccf459f35aca03dc831d12c9bd2f3a884
|
4
|
+
data.tar.gz: b7d131c14ecb22f37924ef2eb5959be2587b854d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d57818da887edc12eb0ff9118c683b3febf6dba41a93d4de43956234e117726fffaa8b2ee49f732d71bf154d6f501e05cf42df354acfe7c2dc762ecd28ea5fd7
|
7
|
+
data.tar.gz: 0f4aec1c103918f6ecaa2b06e91a69f70b03af27e476706196961783d87d6409e3d3f71589b4231842a379292c7f3c2c7586175f47fc225f63afb4cce80c6f94
|
data/ChangeLog
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
=== Release 0.
|
2
|
-
|
1
|
+
=== Release 0.7 / 2015-11-28
|
2
|
+
Added Cucumber 2.0 support
|
3
|
+
|
4
|
+
=== Release 0.6 / 2015-11-28
|
5
|
+
Made the library public friendly. Added support for showing ENV vars in main header & adding debug data to scenarios.
|
3
6
|
|
4
7
|
=== Release 0.5 / 2015-11-20
|
5
8
|
Updated Main ENV var panel
|
data/lib/ugly_face/.DS_Store
CHANGED
Binary file
|
@@ -2,10 +2,8 @@ require 'action_view'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'cucumber/formatter/io'
|
4
4
|
require 'cucumber/formatter/duration'
|
5
|
-
require 'cucumber/
|
6
|
-
require 'cucumber/
|
7
|
-
require 'cucumber/ast/table'
|
8
|
-
require 'cucumber/ast/outline_table'
|
5
|
+
require 'cucumber/core/ast/scenario'
|
6
|
+
require 'cucumber/multiline_argument/data_table'
|
9
7
|
require File.join(File.dirname(__FILE__), 'view_helper')
|
10
8
|
require File.join(File.dirname(__FILE__), 'report')
|
11
9
|
|
@@ -19,7 +17,6 @@ module UglyFace
|
|
19
17
|
class Html
|
20
18
|
include Cucumber::Formatter::Io
|
21
19
|
include Cucumber::Formatter::Duration
|
22
|
-
include Cucumber::Formatter::Console
|
23
20
|
include ViewHelper
|
24
21
|
|
25
22
|
attr_reader :report, :logo
|
@@ -90,18 +87,19 @@ module UglyFace
|
|
90
87
|
end
|
91
88
|
|
92
89
|
def before_feature_element(feature_element)
|
93
|
-
|
90
|
+
# unless scenario_outline? feature_element
|
94
91
|
@report.add_scenario ReportScenario.new(feature_element)
|
95
|
-
|
92
|
+
# end
|
96
93
|
end
|
97
94
|
|
98
95
|
def after_feature_element(feature_element)
|
99
|
-
|
96
|
+
# unless scenario_outline?(feature_element)
|
100
97
|
process_scenario(feature_element)
|
101
|
-
|
98
|
+
# end
|
102
99
|
end
|
103
100
|
|
104
101
|
def before_table_row(example_row)
|
102
|
+
@before_example_row = example_row
|
105
103
|
@report.add_scenario ReportScenario.new(example_row) unless info_row?(example_row)
|
106
104
|
end
|
107
105
|
|
@@ -110,7 +108,7 @@ module UglyFace
|
|
110
108
|
@report.current_scenario.populate(example_row)
|
111
109
|
build_scenario_outline_steps(example_row)
|
112
110
|
end
|
113
|
-
populate_cells(example_row) if example_row.instance_of? Cucumber::Ast::
|
111
|
+
populate_cells(example_row) if example_row.instance_of? Cucumber::Core::Ast::DataTable
|
114
112
|
end
|
115
113
|
|
116
114
|
def before_step(step)
|
@@ -237,7 +235,7 @@ module UglyFace
|
|
237
235
|
report_step = ReportStep.new(step)
|
238
236
|
report_step.duration = duration
|
239
237
|
report_step.status = status unless status.nil?
|
240
|
-
if step.background
|
238
|
+
if step.background
|
241
239
|
@report.current_feature.background << report_step if @report.processing_background_steps?
|
242
240
|
else
|
243
241
|
@report.add_step report_step
|
@@ -246,12 +244,12 @@ module UglyFace
|
|
246
244
|
end
|
247
245
|
|
248
246
|
def scenario_outline?(feature_element)
|
249
|
-
feature_element.is_a? Cucumber::Ast::ScenarioOutline
|
247
|
+
feature_element.is_a? Cucumber::Core::Ast::ScenarioOutline
|
250
248
|
end
|
251
249
|
|
252
250
|
def info_row?(example_row)
|
253
251
|
return example_row.scenario_outline.nil? if example_row.respond_to? :scenario_outline
|
254
|
-
return true if example_row.instance_of? Cucumber::Ast::
|
252
|
+
return true if example_row.instance_of? Cucumber::Formatter::LegacyApi::Ast::DataTableRow
|
255
253
|
false
|
256
254
|
end
|
257
255
|
|
@@ -261,12 +259,15 @@ module UglyFace
|
|
261
259
|
end
|
262
260
|
|
263
261
|
def build_scenario_outline_steps(example_row)
|
264
|
-
si = example_row.
|
262
|
+
si = example_row.cells
|
265
263
|
si.each do |row|
|
266
|
-
|
264
|
+
duration = Time.now - @step_timer
|
265
|
+
report_step = ReportStep.new(@before_example_row, example_row)
|
266
|
+
report_step.duration = duration
|
267
|
+
@report.add_step report_step
|
268
|
+
# process_step(row, row.status)
|
267
269
|
end
|
268
270
|
end
|
269
|
-
|
270
271
|
def step_error(exception)
|
271
272
|
return nil if exception.nil?
|
272
273
|
exception.backtrace[-1] =~ /^#{step.file_colon_line}/ ? exception : nil
|
@@ -130,13 +130,15 @@ module UglyFace
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def scenario_average_duration
|
133
|
-
|
133
|
+
has_duration = scenarios.reject { |scenario| scenario.duration.nil? }
|
134
|
+
durations = has_duration.collect { |scenario| scenario.duration }
|
134
135
|
formatted_duration(durations.reduce(:+).to_f / durations.size)
|
135
136
|
end
|
136
137
|
|
137
138
|
def step_average_duration
|
138
139
|
steps = scenarios.collect { |scenario| scenario.steps }
|
139
|
-
|
140
|
+
has_duration = steps.flatten.reject { |step| step.duration.nil? }
|
141
|
+
durations = has_duration.collect { |step| step.duration }
|
140
142
|
formatted_duration(durations.reduce(:+).to_f / durations.size)
|
141
143
|
end
|
142
144
|
|
@@ -174,14 +176,14 @@ module UglyFace
|
|
174
176
|
|
175
177
|
def populate(scenario)
|
176
178
|
@duration = Time.now - @start
|
177
|
-
|
179
|
+
@status = scenario.status
|
180
|
+
if scenario.instance_of? Cucumber::Formatter::LegacyApi::Ast::Scenario
|
181
|
+
@name = scenario.name
|
182
|
+
@file_colon_line = scenario.line
|
183
|
+
elsif scenario.instance_of? Cucumber::Formatter::LegacyApi::Ast::ExampleTableRow
|
178
184
|
@name = scenario.name
|
179
|
-
@file_colon_line = scenario.
|
180
|
-
elsif scenario.instance_of? Cucumber::Ast::OutlineTable::ExampleRow
|
181
|
-
@name = scenario.scenario_outline.name
|
182
|
-
@file_colon_line = scenario.backtrace_line
|
185
|
+
@file_colon_line = scenario.line
|
183
186
|
end
|
184
|
-
@status = scenario.status
|
185
187
|
end
|
186
188
|
|
187
189
|
def has_image?
|
@@ -192,19 +194,22 @@ module UglyFace
|
|
192
194
|
class ReportStep
|
193
195
|
attr_accessor :name, :keyword, :file_colon_line, :status, :duration, :table, :multiline_arg, :error
|
194
196
|
|
195
|
-
def initialize(step)
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
197
|
+
def initialize(step, ast_step=nil)
|
198
|
+
if ast_step
|
199
|
+
@name = ast_step.name
|
200
|
+
@keyword = ast_step.keyword
|
201
|
+
@status = ast_step.status
|
202
|
+
@error = ast_step.exception
|
203
|
+
else
|
204
|
+
@name = step.name
|
205
|
+
unless step.instance_of? Cucumber::Formatter::LegacyApi::Ast::Background
|
202
206
|
@keyword = step.keyword
|
207
|
+
@status = step.status
|
208
|
+
@multiline_arg = step.multiline_arg unless step.multiline_arg.instance_of? Cucumber::Core::Ast::EmptyMultilineArgument
|
209
|
+
@error = step.exception
|
203
210
|
end
|
204
|
-
@status = step.status
|
205
|
-
@multiline_arg = step.multiline_arg
|
206
|
-
@error = step.exception
|
207
211
|
end
|
212
|
+
@file_colon_line = step.file_colon_line
|
208
213
|
end
|
209
214
|
|
210
215
|
def failed_with_error?
|
@@ -249,7 +254,7 @@ module UglyFace
|
|
249
254
|
end
|
250
255
|
|
251
256
|
def snippet_for(error_line)
|
252
|
-
|
257
|
+
file, line = file_name_and_line(error_line)
|
253
258
|
if file
|
254
259
|
[lines_around(file, line), line, file]
|
255
260
|
else
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'cucumber/ast/scenario_outline'
|
1
|
+
require 'cucumber/core/ast/scenario_outline'
|
2
2
|
|
3
3
|
module UglyFace
|
4
4
|
module Formatter
|
@@ -23,13 +23,15 @@ module UglyFace
|
|
23
23
|
def step_average_duration(features)
|
24
24
|
scenarios = features.collect { |feature| feature.scenarios }
|
25
25
|
steps = scenarios.flatten.collect { |scenario| scenario.steps }
|
26
|
-
|
26
|
+
has_duration = steps.flatten.reject { |step| step.duration.nil? }
|
27
|
+
durations = has_duration.collect { |step| step.duration }
|
27
28
|
format_duration get_average_from_float_array durations
|
28
29
|
end
|
29
30
|
|
30
31
|
def scenario_average_duration(features)
|
31
32
|
scenarios = features.collect { |feature| feature.scenarios }
|
32
|
-
|
33
|
+
has_duration = scenarios.flatten.reject { |scenario| scenario.duration.nil? }
|
34
|
+
durations = has_duration.collect { |scenario| scenario.duration }
|
33
35
|
format_duration get_average_from_float_array durations
|
34
36
|
end
|
35
37
|
|
@@ -24,16 +24,21 @@
|
|
24
24
|
</table>
|
25
25
|
<% end %>
|
26
26
|
<% if step.failed_with_error? %>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
<table>
|
28
|
+
<tr class="error">
|
29
|
+
<td class="message">
|
30
|
+
<strong><pre><%= "#{step.error.message} (#{step.error.class})" %></pre></strong>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td>
|
35
|
+
<%= raw(step.extra_failure_content(step.error.backtrace)) %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<tr >
|
39
|
+
<td class="detail">
|
40
|
+
<pre><%= step.error.backtrace.join("\n") %></pre>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
</table>
|
39
44
|
<% end %>
|
data/lib/ugly_face/version.rb
CHANGED