res 1.2.11 → 1.2.12
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/formatters/rspec.rb +2 -2
- data/lib/res/formatters/ruby_cucumber2.rb +23 -19
- data/lib/res/parsers/android_junit.rb +24 -20
- data/lib/res/parsers/junit.rb +16 -17
- data/lib/res/reporters/test_rail.rb +11 -13
- data/lib/res/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fa3f63bf69641606ead0c84b5f495ee55ec0c84
|
4
|
+
data.tar.gz: bf4bdb3d3e75bcf7dc67e1fbe7572e4a14742c52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfdf0bf42bf29a42febf405efe1ac577592d8e31651e0cae4eb79b9019bf0c33cd9b51996fbc5817f4691432534ce750d8664dcf214621eff7149d9782bf15b
|
7
|
+
data.tar.gz: ebd752c7a0dd9fdc3067fb4ae0418814be9ad1a94c77dee6657371913c72e2e27221f4bc17977cdcb7ea93bfc950b983d264b58d4f3ea21dabce60c264ad36ce
|
data/lib/res/formatters/rspec.rb
CHANGED
@@ -38,8 +38,8 @@ module Res
|
|
38
38
|
index =0
|
39
39
|
end
|
40
40
|
while i < group_notification.group.examples.count
|
41
|
-
result[@count][:children] = Array.new
|
42
|
-
result[@count][:children][index] =
|
41
|
+
result[@count][:children] = Array.new unless result[@count].has_key?(:children)
|
42
|
+
result[@count][:children][index] = {}
|
43
43
|
result[@count][:children][index] = add_result(group_notification.group.examples[i].metadata)
|
44
44
|
index += 1
|
45
45
|
i += 1
|
@@ -14,7 +14,11 @@ module Res
|
|
14
14
|
|
15
15
|
def initialize(runtime, path_or_io, options)
|
16
16
|
@runtime = runtime
|
17
|
-
|
17
|
+
begin
|
18
|
+
@io = ensure_io(path_or_io)
|
19
|
+
rescue
|
20
|
+
@io = ensure_io(path_or_io, '')
|
21
|
+
end
|
18
22
|
@options = options
|
19
23
|
@exceptions = []
|
20
24
|
@indent = 0
|
@@ -32,7 +36,7 @@ module Res
|
|
32
36
|
def after_features(features)
|
33
37
|
results = @_features
|
34
38
|
ir = ::Res::IR.new( :started => @_start_time,
|
35
|
-
:finished => Time.now
|
39
|
+
:finished => Time.now,
|
36
40
|
:results => results,
|
37
41
|
:type => 'Cucumber' )
|
38
42
|
@io.puts ir.json
|
@@ -41,7 +45,7 @@ module Res
|
|
41
45
|
def before_feature(feature)
|
42
46
|
@_feature = {}
|
43
47
|
@_context = {}
|
44
|
-
@_feature[:started] = Time.now
|
48
|
+
@_feature[:started] = Time.now
|
45
49
|
begin
|
46
50
|
hash = RubyCucumber2.split_uri( feature.location.to_s )
|
47
51
|
@_feature[:file] = hash[:file]
|
@@ -55,7 +59,7 @@ module Res
|
|
55
59
|
end
|
56
60
|
|
57
61
|
def comment_line(comment_line)
|
58
|
-
@_context[:comments] = []
|
62
|
+
@_context[:comments] = [] unless @_context[:comments]
|
59
63
|
@_context[:comments] << comment_line
|
60
64
|
end
|
61
65
|
|
@@ -63,7 +67,7 @@ module Res
|
|
63
67
|
end
|
64
68
|
|
65
69
|
def tag_name(tag_name)
|
66
|
-
@_context[:tags] = []
|
70
|
+
@_context[:tags] = [] unless @_context[:tag]
|
67
71
|
# Strip @ from tags
|
68
72
|
@_context[:tags] << tag_name[1..-1]
|
69
73
|
end
|
@@ -72,7 +76,7 @@ module Res
|
|
72
76
|
# :name => 'Feature name',
|
73
77
|
# :description => "As a blah\nAs a blah\n" }
|
74
78
|
def feature_name(keyword, name)
|
75
|
-
@_feature[:type] = "Cucumber
|
79
|
+
@_feature[:type] = "Cucumber::#{keyword.gsub(/\s+/, '')}"
|
76
80
|
|
77
81
|
lines = name.split("\n")
|
78
82
|
lines = lines.collect { |l| l.strip }
|
@@ -82,7 +86,7 @@ module Res
|
|
82
86
|
end
|
83
87
|
|
84
88
|
def after_feature(feature)
|
85
|
-
@_feature[:finished] = Time.now
|
89
|
+
@_feature[:finished] = Time.now
|
86
90
|
end
|
87
91
|
|
88
92
|
def before_feature_element(feature_element)
|
@@ -100,7 +104,7 @@ module Res
|
|
100
104
|
@_feature_element[:file] = 'unknown'
|
101
105
|
end
|
102
106
|
|
103
|
-
@_feature[:children] = []
|
107
|
+
@_feature[:children] = [] unless @_feature[:children]
|
104
108
|
|
105
109
|
@_feature[:children] << @_feature_element
|
106
110
|
@_context = @_feature_element
|
@@ -122,7 +126,7 @@ module Res
|
|
122
126
|
end
|
123
127
|
|
124
128
|
if fail.compact.empty? and feature_element.respond_to? :status
|
125
|
-
@_feature_element[:status] = feature_element.status if feature_element.status.to_s !=
|
129
|
+
@_feature_element[:status] = feature_element.status if feature_element.status.to_s != 'skipped'
|
126
130
|
else
|
127
131
|
fail = fail.compact
|
128
132
|
@_feature_element[:status] = fail[0].status
|
@@ -147,7 +151,7 @@ module Res
|
|
147
151
|
|
148
152
|
|
149
153
|
def scenario_name(keyword, name, file_colon_line, source_indent)
|
150
|
-
@_context[:type] = "Cucumber
|
154
|
+
@_context[:type] = "Cucumber::#{keyword.gsub(/\s+/, '')}"
|
151
155
|
@_context[:name] = name || ''
|
152
156
|
end
|
153
157
|
|
@@ -159,8 +163,8 @@ module Res
|
|
159
163
|
# to scenario that don't exist
|
160
164
|
return if @_feature_element && @_feature_element[:finished]
|
161
165
|
|
162
|
-
@_feature_element = {}
|
163
|
-
@_feature_element[:children] = []
|
166
|
+
@_feature_element = {} unless @_feature_element
|
167
|
+
@_feature_element[:children] = [] unless @_feature_element[:children]
|
164
168
|
@_feature_element[:children] << @_step
|
165
169
|
@_context = @_step
|
166
170
|
end
|
@@ -169,12 +173,12 @@ module Res
|
|
169
173
|
|
170
174
|
file_colon_line = args[0] if args[0]
|
171
175
|
|
172
|
-
@_step[:type] =
|
176
|
+
@_step[:type] = 'Cucumber::Step'
|
173
177
|
name = keyword + step_match.format_args(lambda{|param| %{#{param}}})
|
174
178
|
@_step[:name] = name
|
175
179
|
@_step[:status] = status
|
176
180
|
#@_step[:background] = background
|
177
|
-
@_step[:type] =
|
181
|
+
@_step[:type] = 'Cucumber::Step'
|
178
182
|
|
179
183
|
end
|
180
184
|
|
@@ -208,23 +212,23 @@ module Res
|
|
208
212
|
|
209
213
|
def before_table_row(table_row)
|
210
214
|
@_current_table_row = { :type => 'Cucumber::ScenarioOutline::Example' }
|
211
|
-
@_table = []
|
215
|
+
@_table = [] unless @_table
|
212
216
|
end
|
213
217
|
|
214
218
|
def after_table_row(table_row)
|
215
|
-
|
219
|
+
if table_row.class == Cucumber::Formatter::LegacyApi::Ast::ExampleTableRow
|
216
220
|
|
217
221
|
@_current_table_row[:name] = table_row.name
|
218
222
|
if table_row.exception
|
219
223
|
@_current_table_row[:message] = table_row.exception.to_s
|
220
224
|
end
|
221
225
|
|
222
|
-
if table_row.status and table_row.status !=
|
226
|
+
if table_row.status and table_row.status != 'skipped' and table_row.status != nil
|
223
227
|
@_current_table_row[:status] = table_row.status
|
224
228
|
end
|
225
229
|
|
226
230
|
@_current_table_row[:line] = table_row.line
|
227
|
-
@_current_table_row[:urn] = @_feature_element[:file] +
|
231
|
+
@_current_table_row[:urn] = @_feature_element[:file] + ':' + table_row.line.to_s
|
228
232
|
@_table << @_current_table_row
|
229
233
|
end
|
230
234
|
end
|
@@ -234,7 +238,7 @@ module Res
|
|
234
238
|
|
235
239
|
def table_cell_value(value, status)
|
236
240
|
@_current_table_row[:children] = [] if !@_current_table_row[:children]
|
237
|
-
@_current_table_row[:children] << { :type =>
|
241
|
+
@_current_table_row[:children] << { :type => 'Cucumber::ScenarioOutline::Parameter',
|
238
242
|
:name => value, :status => status }
|
239
243
|
end
|
240
244
|
|
@@ -6,51 +6,55 @@ module Res
|
|
6
6
|
attr_accessor :io
|
7
7
|
|
8
8
|
def initialize(instrument_output)
|
9
|
-
result = Array.new
|
10
9
|
result = parse(instrument_output)
|
11
10
|
ir = ::Res::IR.new( :type => 'AndroidJUnitRunner',
|
12
|
-
:started =>
|
13
|
-
:finished => Time.now
|
11
|
+
:started => '',
|
12
|
+
:finished => Time.now,
|
14
13
|
:results => result
|
15
14
|
)
|
16
|
-
@io = File.open(
|
15
|
+
@io = File.open('./instruments.res', 'w')
|
17
16
|
@io.puts ir.json
|
18
17
|
@io.close
|
19
18
|
end
|
20
19
|
|
21
20
|
def parse(output)
|
22
|
-
class_name =
|
23
|
-
|
24
|
-
result = Array.new
|
21
|
+
class_name = []
|
22
|
+
result = []
|
25
23
|
test = {
|
26
|
-
type:
|
24
|
+
type: 'AndroidJUnit::Test',
|
27
25
|
name: 'UNKNOWN',
|
28
|
-
status:
|
26
|
+
status: 'passed'
|
29
27
|
}
|
28
|
+
|
30
29
|
File.open(output) do |f|
|
31
30
|
f.each_line do |line|
|
32
|
-
|
31
|
+
|
32
|
+
if line.include?('INSTRUMENTATION_STATUS_CODE')
|
33
|
+
# Skip if this is just the 'pre-run' test
|
34
|
+
if line.include?('INSTRUMENTATION_STATUS_CODE: 1')
|
35
|
+
next
|
36
|
+
end
|
33
37
|
result.last[:children] << test
|
34
38
|
test = {
|
35
|
-
type:
|
39
|
+
type: 'AndroidJUnit::Test',
|
36
40
|
name: 'UNKNOWN',
|
37
|
-
status:
|
41
|
+
status: 'passed'
|
38
42
|
}
|
39
43
|
end
|
40
44
|
|
41
|
-
if line.include?(
|
42
|
-
line = line.gsub(
|
43
|
-
|
44
|
-
class_name.push(line)
|
45
|
+
if line.include?('class')
|
46
|
+
line = line.gsub('INSTRUMENTATION_STATUS: class=', '').strip
|
47
|
+
unless class_name.include? line
|
48
|
+
class_name.push(line)
|
45
49
|
result << {
|
46
|
-
type:
|
50
|
+
type: 'AndroidJUnit::Class',
|
47
51
|
name: class_name.last,
|
48
52
|
children: Array.new
|
49
53
|
}
|
50
54
|
end
|
51
|
-
elsif line.include?(
|
52
|
-
test[:name] = line.gsub(
|
53
|
-
elsif line.include?(
|
55
|
+
elsif line.include?('test=')
|
56
|
+
test[:name] = line.gsub('INSTRUMENTATION_STATUS: test=', '').strip
|
57
|
+
elsif line.include?('Error in ')
|
54
58
|
test[:status] = 'failed'
|
55
59
|
end
|
56
60
|
end
|
data/lib/res/parsers/junit.rb
CHANGED
@@ -15,45 +15,44 @@ module Res
|
|
15
15
|
raise "Invalid xunit XML format. Error: #{e}"
|
16
16
|
end
|
17
17
|
file.close
|
18
|
-
result = Array.new
|
19
18
|
result = attach_suite(junit)
|
20
19
|
ir = ::Res::IR.new( :type => 'Junit',
|
21
|
-
:started =>
|
22
|
-
:finished => Time.now
|
20
|
+
:started => '',
|
21
|
+
:finished => Time.now,
|
23
22
|
:results => result
|
24
23
|
)
|
25
|
-
@io = File.open(
|
24
|
+
@io = File.open('./junit.res', 'w')
|
26
25
|
@io.puts ir.json
|
27
26
|
@io.close
|
28
27
|
end
|
29
28
|
|
30
29
|
def attach_cases(node)
|
31
30
|
testcase = Hash.new
|
32
|
-
testcase[
|
33
|
-
testcase[
|
34
|
-
testcase[
|
35
|
-
testcase[
|
36
|
-
testcase[
|
31
|
+
testcase['type'] = "JUnit::#{node.value}"
|
32
|
+
testcase['name'] = node.attributes[:name]
|
33
|
+
testcase['classname'] = node.attributes[:classname] if testcase['classname'] != nil
|
34
|
+
testcase['duration'] = node.attributes[:time]
|
35
|
+
testcase['status'] = 'passed'
|
37
36
|
if node.nodes[0] != nil
|
38
|
-
testcase[
|
39
|
-
testcase[
|
37
|
+
testcase['status'] = 'failed' if node.nodes[0].value == 'failure' or node.nodes[0].value == 'error'
|
38
|
+
testcase['status'] = 'notrun' if node.nodes[0].value == 'skipped'
|
40
39
|
end
|
41
40
|
testcase
|
42
41
|
end
|
43
42
|
|
44
43
|
def attach_suite(component)
|
45
|
-
suite =
|
44
|
+
suite = []
|
46
45
|
index = 0
|
47
46
|
component.nodes.each do |node|
|
48
|
-
if node.value ==
|
47
|
+
if node.value == 'testcase'
|
49
48
|
suite[index] = Hash.new
|
50
49
|
suite[index] = attach_cases(node)
|
51
50
|
else
|
52
51
|
suite[index] = Hash.new
|
53
|
-
suite[index][
|
54
|
-
suite[index][
|
55
|
-
suite[index][
|
56
|
-
suite[index][
|
52
|
+
suite[index]['type'] = "JUnit::#{node.value}"
|
53
|
+
suite[index]['name'] = node.attributes[:name]
|
54
|
+
suite[index]['classname'] = node.attributes[:classname] if suite[index]['classname'] != nil
|
55
|
+
suite[index]['children'] = attach_suite(node)
|
57
56
|
end # if
|
58
57
|
index += 1
|
59
58
|
end # each
|
@@ -14,7 +14,7 @@ module Res
|
|
14
14
|
config.process(args)
|
15
15
|
|
16
16
|
@case_status = {}
|
17
|
-
@io = File.new(
|
17
|
+
@io = File.new('./.test_rail_reporter.log','w+')
|
18
18
|
|
19
19
|
test_rail_project = config.project
|
20
20
|
@suite_name = config.suite
|
@@ -35,7 +35,7 @@ module Res
|
|
35
35
|
@mappings = Res::Mappings.new(@ir.type)
|
36
36
|
|
37
37
|
suite = @project.find_or_create_suite(:name => @suite_name, :id => @project.id)
|
38
|
-
@io.puts
|
38
|
+
@io.puts 'Syncing Suite'
|
39
39
|
|
40
40
|
i = 0
|
41
41
|
while i < @ir.results.count
|
@@ -44,13 +44,13 @@ module Res
|
|
44
44
|
i += 1
|
45
45
|
end # while
|
46
46
|
@synced = true
|
47
|
-
@io.puts
|
47
|
+
@io.puts '> Sync Successful'
|
48
48
|
end
|
49
49
|
|
50
50
|
# Submits run against suite
|
51
51
|
# Either creates a new run using run_name or use existing run_id
|
52
52
|
def submit_results(ir, args = {})
|
53
|
-
sync_tests(ir)
|
53
|
+
sync_tests(ir) unless @synced
|
54
54
|
suite = @project.find_suite(:name => @suite_name)
|
55
55
|
|
56
56
|
run_name = @config.run_name || args[:run_name] || nil
|
@@ -74,9 +74,9 @@ module Res
|
|
74
74
|
end
|
75
75
|
|
76
76
|
else
|
77
|
-
@io.puts
|
77
|
+
@io.puts '> run_name and run_id are either nil or not specified'
|
78
78
|
@io.close
|
79
|
-
return
|
79
|
+
return 'run_name and run_id are either nil or not specified'
|
80
80
|
|
81
81
|
end
|
82
82
|
|
@@ -94,10 +94,10 @@ module Res
|
|
94
94
|
end # while
|
95
95
|
end # ifa
|
96
96
|
add_case_status(run_id)
|
97
|
-
@io.puts
|
98
|
-
@io.puts
|
97
|
+
@io.puts '> Added the test case status'
|
98
|
+
@io.puts '> Submit Successful'
|
99
99
|
@io.close
|
100
|
-
|
100
|
+
'Submitted to Test Rail'
|
101
101
|
end
|
102
102
|
|
103
103
|
def tr
|
@@ -136,11 +136,9 @@ module Res
|
|
136
136
|
if @mappings.context.include?(child[:type])
|
137
137
|
section = section.find_section(:name => child[:name])
|
138
138
|
case_details(child, section)
|
139
|
-
|
140
139
|
elsif @mappings.case.include?(child[:type])
|
141
|
-
tcase = section.find_test_case(:title => child[:name])
|
142
|
-
@case_status[:"#{tcase.id}"] = child[:status]
|
143
|
-
|
140
|
+
tcase = section.find_test_case(:title => child[:name]) unless section.nil?
|
141
|
+
@case_status[:"#{tcase.id}"] = child[:status] unless tcase.nil?
|
144
142
|
end
|
145
143
|
end
|
146
144
|
end
|
data/lib/res/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: res
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.5.
|
131
|
+
rubygems_version: 2.5.1
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Test Result report libraries
|