step-stats 1.0.0 → 1.1.0
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/lib/step_stats/args_stats.rb +19 -0
- data/lib/step_stats/step_stats_formatter.rb +12 -4
- data/lib/step_stats/table_partial.erb +34 -1
- data/lib/step_stats/template.erb +6 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0b40dcd8ccde973c8386edc15bac778404f1641
|
4
|
+
data.tar.gz: 1d59f6abb56ca68c4bac7678c601a116bf2dfb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e7da7cf78ea7b98ed7cedc5713651f6a76f672f10f1703fb32f2f2c3f94184276f8d7a8fd1cc4eb7a38e384955b802bf2c56f6664bb2a4ace4a28e422e454d9
|
7
|
+
data.tar.gz: 3fa5c88d606f423f0982a1eac7535168f456003e52a210d7e52473c39c856fc5a35daee2aafe82c67a7837e9767b5584d533f395d3d2f23b8e11bdabe4633b7d
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StepStats
|
2
|
+
class ArgsStats < StepStats::Stats
|
3
|
+
|
4
|
+
def add_stat(step_match, duration, status, location)
|
5
|
+
step_number = get_step_number step_match.format_args
|
6
|
+
if @stats[step_number].nil?
|
7
|
+
@stats[step_number] = Step.new(step_match.format_args, step_match.file_colon_line)
|
8
|
+
end
|
9
|
+
step_entry = {duration: duration, status: status, location: location}
|
10
|
+
@stats[step_number].add step_entry
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_step_number(format_args)
|
14
|
+
@steps[format_args] = @step_counter.next!.dup if @steps[format_args].nil?
|
15
|
+
@steps[format_args]
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -1,33 +1,41 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'cucumber/formatter/pretty'
|
3
|
+
require 'step_stats/args_stats'
|
3
4
|
|
4
5
|
module StepStats
|
5
6
|
class Formatter < Cucumber::Formatter::Pretty
|
6
7
|
def initialize(step_mother, io, options)
|
7
8
|
@sss = Stats.new
|
9
|
+
@sas = StepStats::ArgsStats.new
|
8
10
|
super
|
9
11
|
end
|
10
12
|
|
11
13
|
def before_step(step)
|
12
|
-
@start_time = `
|
14
|
+
@start_time = `date +%s.%N`.to_f
|
13
15
|
super
|
14
16
|
end
|
15
17
|
|
16
18
|
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
17
|
-
@duration = `
|
19
|
+
@duration = `date +%s.%N`.to_f - @start_time
|
18
20
|
@sss.add_stat(step_match.step_definition,@duration,status,file_colon_line) if @duration > 0 && !step_match.step_definition.nil?
|
21
|
+
@sas.add_stat(step_match,@duration,status,file_colon_line) if @duration > 0 && !step_match.step_definition.nil?
|
19
22
|
super
|
20
23
|
end
|
21
24
|
|
22
25
|
def after_features(*args)
|
26
|
+
plot_graph(@sss,@sas)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def plot_graph(data1,data2)
|
23
31
|
@path = File.dirname(__FILE__)
|
24
32
|
template = File.read(@path+"/template.erb")
|
25
|
-
@
|
33
|
+
@data1 = data1.stats
|
34
|
+
@data2 = data2.stats
|
26
35
|
result = ERB.new(template, 0, "", "@html").result(binding)
|
27
36
|
stats_html_file = File.new('tmp/step_stats.html','w')
|
28
37
|
stats_html_file.write(result)
|
29
38
|
stats_html_file.close
|
30
|
-
super
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<td>Min</td>
|
9
9
|
<td>Count</td>
|
10
10
|
</thead>
|
11
|
-
<% @
|
11
|
+
<% @data1.each_with_index do |stat,index| %>
|
12
12
|
<tr data-durations="<%= ERB::Util.h(stat.to_chart_data) %>" style="cursor: pointer; cursor: hand">
|
13
13
|
<td>
|
14
14
|
<span><%= index+1 %></span>
|
@@ -30,3 +30,36 @@
|
|
30
30
|
</tr>
|
31
31
|
<% end %>
|
32
32
|
</table>
|
33
|
+
<br><hr><br>
|
34
|
+
<table id="all-table" class="data-table table table-hover">
|
35
|
+
<thead>
|
36
|
+
<td>Step</td>
|
37
|
+
<td>Definition</td>
|
38
|
+
<td>Avg</td>
|
39
|
+
<td>SD</td>
|
40
|
+
<td>Max</td>
|
41
|
+
<td>Min</td>
|
42
|
+
<td>Count</td>
|
43
|
+
</thead>
|
44
|
+
<% @data2.each_with_index do |stat,index| %>
|
45
|
+
<tr data-durations="<%= ERB::Util.h(stat.to_chart_data) %>" style="cursor: pointer; cursor: hand">
|
46
|
+
<td>
|
47
|
+
<span><%= index+1 %></span>
|
48
|
+
<span class="percentage">
|
49
|
+
<%= @sas.percent(stat,'floor') %>%
|
50
|
+
</span>
|
51
|
+
</td>
|
52
|
+
<td title="<%= stat.location %>" style="background: -webkit-linear-gradient(left, #DC4141 <%= @sss.percent(stat) %>%, white <%= @sss.percent(stat) %>%);"><%= stat.name %></td>
|
53
|
+
<td><%= stat.avg %></td>
|
54
|
+
<td><%= stat.stddev %></td>
|
55
|
+
<td><%= stat.max %></td>
|
56
|
+
<td><%= stat.min %></td>
|
57
|
+
<td><%= stat.count %></td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td colspan="7">
|
61
|
+
<div id="chart-<%= index+1 %>" class="details_chart">Details</div>
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
<% end %>
|
65
|
+
</table>
|
data/lib/step_stats/template.erb
CHANGED
@@ -68,15 +68,19 @@
|
|
68
68
|
<%= ERB.new(File.read(@path+"/table_partial.erb")).result(binding) %>
|
69
69
|
</div>
|
70
70
|
<div role="tabpanel" class="tab-pane" id="top30time">
|
71
|
-
<% @
|
71
|
+
<% @data1 = @sss.top30time %>
|
72
|
+
<% @data2 = @sas.top30time %>
|
72
73
|
<%= ERB.new(File.read(@path+"/table_partial.erb")).result(binding) %>
|
73
74
|
</div>
|
74
75
|
<div role="tabpanel" class="tab-pane" id="top30count">
|
75
|
-
<% @
|
76
|
+
<% @data1 = @sss.top30count %>
|
77
|
+
<% @data2 = @sas.top30count %>
|
76
78
|
<%= ERB.new(File.read(@path+"/table_partial.erb")).result(binding) %>
|
77
79
|
</div>
|
78
80
|
<div role="tabpanel" class="tab-pane" id="timeperstep">
|
79
81
|
<span data-results="<%= ERB::Util.h(@sss.to_chart_data) %>"></span>
|
82
|
+
<br><hr><br>
|
83
|
+
<span data-results="<%= ERB::Util.h(@sas.to_chart_data) %>"></span>
|
80
84
|
<div class="tps_chart"></div>
|
81
85
|
</div>
|
82
86
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: step-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sundus Yousuf
|
@@ -32,6 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- lib/step-stats.rb
|
35
|
+
- lib/step_stats/args_stats.rb
|
35
36
|
- lib/step_stats/stats.rb
|
36
37
|
- lib/step_stats/step.rb
|
37
38
|
- lib/step_stats/step_stats_formatter.rb
|