res 1.2.9 → 1.2.10
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/res/ir.rb +36 -2
- data/lib/res/reporters/lion.rb +1 -17
- data/lib/res/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: b986b0f17b7b9aad06b6e35f9418670af1bbdb11
|
4
|
+
data.tar.gz: 8a5332a148de9511660da0b0a9455bbb14e5727d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69894b149c73ac34a736452fe3ef8c2e16b8d9f1f9858fd4b05c793a4ce7303ad98525f89c8095011255a947c71c6e84b05fc53955c55fb494f5db93c3298ca1
|
7
|
+
data.tar.gz: 1121aa1fc81a2795f19e600426b389447647853aa9af49efa4e4c1aabe8277429da32b76477ad2b58904452f69bd5c9a53b58ab6f648b08b3ee2f380c4ce4adb
|
data/lib/res/ir.rb
CHANGED
@@ -2,7 +2,7 @@ require 'json'
|
|
2
2
|
|
3
3
|
module Res
|
4
4
|
class IR
|
5
|
-
attr_accessor :hash, :results, :type, :start_time, :end_time, :world
|
5
|
+
attr_accessor :hash, :results, :type, :start_time, :end_time, :world, :values
|
6
6
|
attr_accessor :project, :suite, :target, :hive_job_id
|
7
7
|
|
8
8
|
def self.load(file)
|
@@ -21,8 +21,28 @@ module Res
|
|
21
21
|
@type = options[:type] or raise "No type provided (e.g. 'Cucumber')"
|
22
22
|
@started = options[:started] or raise "Need to provide a start time"
|
23
23
|
@finished = options[:finished] or raise "Need to provide an end time"
|
24
|
+
@values = initialize_values( options[:values], options[:results] )
|
24
25
|
end
|
25
|
-
|
26
|
+
|
27
|
+
def initialize_values( initial_values, results_hash )
|
28
|
+
h = {}
|
29
|
+
if initial_values && !initial_values.empty?
|
30
|
+
initial_values.each do |k,v|
|
31
|
+
h[k.to_s] = v
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
IR.find_values( results_hash ).each do |i|
|
36
|
+
if !i.empty?
|
37
|
+
i.each do |k,v|
|
38
|
+
h[k.to_s] = v
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
h
|
44
|
+
end
|
45
|
+
|
26
46
|
# Dump as json
|
27
47
|
def json
|
28
48
|
hash = {
|
@@ -60,6 +80,20 @@ module Res
|
|
60
80
|
|
61
81
|
private
|
62
82
|
|
83
|
+
# Recursive function for retrieving values in nodes
|
84
|
+
def self.find_values(nodes)
|
85
|
+
value_hashes = []
|
86
|
+
nodes.each do |n|
|
87
|
+
if n[:values]
|
88
|
+
value_hashes << n[:values]
|
89
|
+
end
|
90
|
+
if n[:children]
|
91
|
+
value_hashes += IR.find_values(n[:children])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
value_hashes
|
95
|
+
end
|
96
|
+
|
63
97
|
# Recursive function for retrieving test nodes
|
64
98
|
def self.find_tests(nodes)
|
65
99
|
tests = []
|
data/lib/res/reporters/lion.rb
CHANGED
@@ -18,22 +18,6 @@ module Res
|
|
18
18
|
status = "failed"
|
19
19
|
status = "passed" if ir.tests.count == ir.count(:passed)
|
20
20
|
|
21
|
-
count = 0
|
22
|
-
values = Array.new
|
23
|
-
while count < ir.tests.count
|
24
|
-
values[count] = ir.tests[count][:values]
|
25
|
-
count += 1
|
26
|
-
end
|
27
|
-
|
28
|
-
perf_values = {}
|
29
|
-
ir.tests.collect do |t|
|
30
|
-
if values = t[:values]
|
31
|
-
values.each do |k,v|
|
32
|
-
perf_values[k] = v if v.is_a? Numeric
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
21
|
# Set Lion Data
|
38
22
|
lion_data = {
|
39
23
|
:app_name => config.app_name,
|
@@ -44,7 +28,7 @@ module Res
|
|
44
28
|
:started => ir.results.first[:started],
|
45
29
|
:finished => ir.results.last[:finished],
|
46
30
|
:status => status,
|
47
|
-
:measures =>
|
31
|
+
:measures => ir.values
|
48
32
|
}
|
49
33
|
|
50
34
|
|
data/lib/res/version.rb
CHANGED