suiteview 2.2.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/suiterender/pie.rb +58 -0
- data/lib/suiterender/suiterender.rb +38 -0
- data/lib/suitestat.rb +10 -0
- data/lib/suiteview.rb +4 -1
- metadata +34 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aaf334c7911739dcf45fa89d2263ba30287abaff5b7528a2df2a4c03bb6f5d1
|
4
|
+
data.tar.gz: 70761f9adf5a899321ce60f1f23793b7f5012201d23448ba341c6401c05aae08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98157d2e458be8a6ccb8bd247a6e029025be4b6b1d31b41da0b61c2dea8ebd2420ea1519d7fa5ec37be50bb1998d0e6700752cd456275db258f8dec55ac01578
|
7
|
+
data.tar.gz: 0302dc38df87ae9b12ecec9923278f91604b928c7eb154aa3b58f5c8cf0549473d7c70f2b94c73d657962b969937ec6706b7acfe2afb333e049e39fc7a23526d
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'csv'
|
2
|
+
require 'chartkick'
|
3
|
+
require 'launchy'
|
4
|
+
|
5
|
+
# The SuiteRender::Pie module makes an html Pie chart
|
6
|
+
class SuiteRender
|
7
|
+
module Pie
|
8
|
+
include Chartkick::Helper
|
9
|
+
def render_pie_chart_html(filename)
|
10
|
+
@filename = filename
|
11
|
+
html = pie_chart_html
|
12
|
+
|
13
|
+
File.open(filename, 'w') do |file|
|
14
|
+
file.puts html
|
15
|
+
end
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
def launch
|
20
|
+
Launchy.open(@filename)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def pie_chart_html
|
28
|
+
csv_string = self.view.output
|
29
|
+
data = {}
|
30
|
+
CSV.parse(csv_string, headers: true) do |row|
|
31
|
+
data[row['tag']] = row['count'].to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
# Group the data by category and calculate the sum of values for each category
|
35
|
+
grouped_data = data.group_by { |k, v| k }
|
36
|
+
.transform_values { |v| v.map(&:last).reduce(:+) }
|
37
|
+
|
38
|
+
pie_chart = pie_chart(grouped_data)
|
39
|
+
|
40
|
+
|
41
|
+
# Return the HTML code for the pie chart
|
42
|
+
<<~HTML
|
43
|
+
<!DOCTYPE html>
|
44
|
+
<html>
|
45
|
+
<head>
|
46
|
+
<title>Pie Chart</title>
|
47
|
+
<script src="https://code.highcharts.com/highcharts.js"></script>
|
48
|
+
<script src="https://cdn.jsdelivr.net/npm/chartkick@5.0.1"></script>
|
49
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.css">
|
50
|
+
</head>
|
51
|
+
<body>
|
52
|
+
<div id="pie-chart" style="height: 300px;"></div>
|
53
|
+
#{pie_chart}
|
54
|
+
</body>
|
55
|
+
</html>
|
56
|
+
HTML
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'csv'
|
2
|
+
require_relative './pie'
|
3
|
+
|
4
|
+
# SuiteRender is responsible for rendering the output of SuiteView
|
5
|
+
class SuiteRender
|
6
|
+
include Pie
|
7
|
+
attr_accessor :next_step, :view
|
8
|
+
|
9
|
+
def initialize(suiteview)
|
10
|
+
self.next_step = nil
|
11
|
+
self.view = suiteview
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.to_csv
|
15
|
+
to_csv
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_csv
|
19
|
+
self.view.output = CSV.generate do |csv|
|
20
|
+
self.view.output.each { |row| csv << row }
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def render_to_file(filename)
|
26
|
+
File.open(filename, "w") do |file|
|
27
|
+
file.puts self.view.output
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def render
|
32
|
+
self.view.output
|
33
|
+
end
|
34
|
+
|
35
|
+
def next_step=(step)
|
36
|
+
@next_step = step
|
37
|
+
end
|
38
|
+
end
|
data/lib/suitestat.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# SuiteStat is a DTO for passing info used to create metrics
|
2
|
+
class SuiteStat
|
3
|
+
attr_accessor :total_count, :output, :tag_counts
|
4
|
+
|
5
|
+
def initialize(output = nil, total_count = 0, tag_counts = {})
|
6
|
+
self.output = output
|
7
|
+
self.total_count = total_count
|
8
|
+
self.tag_counts = tag_counts
|
9
|
+
end
|
10
|
+
end
|
data/lib/suiteview.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'cql'
|
2
2
|
require_relative './suitestat'
|
3
|
-
require_relative './suiterender'
|
3
|
+
require_relative './suiterender/suiterender'
|
4
|
+
require_relative './suiterender/pie'
|
4
5
|
# SuiteView is responsible for providing consumable Ruby Cucumber suite stats
|
5
6
|
class SuiteView
|
7
|
+
include SuiteRender::Pie
|
6
8
|
attr_accessor :repo, :include_tags, :exclude_tag, :output, :render_step
|
7
9
|
|
8
10
|
def initialize(opts)
|
@@ -15,6 +17,7 @@ class SuiteView
|
|
15
17
|
# Create a SuiteRender object and set it as the last step in the chain
|
16
18
|
self.render_step = SuiteRender.new(self)
|
17
19
|
render_step.next_step = self
|
20
|
+
self
|
18
21
|
end
|
19
22
|
|
20
23
|
def outline_tag_count(tag)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suiteview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David West
|
@@ -66,55 +66,44 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
# Instantiate the SuiteView class and give it the location of your Cucumber Suite (repo)
|
100
|
-
sv = SuiteView.new({repo: "features", include_tags: "@tweets,@followers"})
|
101
|
-
|
102
|
-
# Get a count of all Scenarios directly tagged with a particular tag
|
103
|
-
sv.total_tags_count.to_csv.render_to_file("my2.csv")
|
104
|
-
```
|
105
|
-
|
106
|
-
`my2.csv`
|
107
|
-
|
108
|
-
```csv
|
109
|
-
tag,count
|
110
|
-
@tweets,4
|
111
|
-
@followers,1
|
112
|
-
```
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: chartkick
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.4.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.4.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: launchy
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.3
|
97
|
+
description: suiteview is a tool to help show the contents of a cucumber suite with
|
98
|
+
your unique specifications
|
113
99
|
email: support@suiteview.xyz
|
114
100
|
executables: []
|
115
101
|
extensions: []
|
116
102
|
extra_rdoc_files: []
|
117
103
|
files:
|
104
|
+
- lib/suiterender/pie.rb
|
105
|
+
- lib/suiterender/suiterender.rb
|
106
|
+
- lib/suitestat.rb
|
118
107
|
- lib/suiteview.rb
|
119
108
|
homepage: https://github.com/suiteview/suiteview
|
120
109
|
licenses:
|