res 1.2.1 → 1.2.2
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/README.md +2 -2
- data/bin/res +11 -0
- data/lib/res/parsers/android_junit.rb +62 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1faaf3f83f2032befcd21d325961900df987b67d
|
4
|
+
data.tar.gz: c346637e360267722da74951ba8b97574933bc8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6b8b77d0267f8682c050db1251959e594e3225f0b31bfa20ad600e657861a5106d5b2ca4c960569de4195d185e48c5bb67a0b7566905b69d990bfc9dfee418d
|
7
|
+
data.tar.gz: eb60be622904ec78521e5680f5ff66448fb968937d9efd8c6edd485b9297e5630232523143a0a9590a63300ac9e6b10d815d3071fa0fb5f4efb31a24508b8638
|
data/README.md
CHANGED
@@ -28,8 +28,8 @@ You can dump a Res IR results file using a cucumber formatter or parse xunit out
|
|
28
28
|
|
29
29
|
## Cucumber
|
30
30
|
|
31
|
-
cucumber -f pretty -f Res::Formatters::RubyCucumber -o './cucumber.res'
|
32
|
-
|
31
|
+
cucumber -f pretty -f Res::Formatters::RubyCucumber -o './cucumber.res' (cucumber version < 2.0)
|
32
|
+
cucumber -f pretty -f Res::Formatters::RubyCucumber2 -o './cucumber.res' (cucumber version >= 2.0)
|
33
33
|
|
34
34
|
## Rspec
|
35
35
|
|
data/bin/res
CHANGED
@@ -7,6 +7,7 @@ require 'res/reporters/testmine'
|
|
7
7
|
require 'res/reporters/test_rail'
|
8
8
|
require 'res/reporters/hive'
|
9
9
|
require 'res/parsers/junit'
|
10
|
+
require 'res/parsers/android_junit'
|
10
11
|
require 'res/parsers/junitcasper'
|
11
12
|
require 'openssl'
|
12
13
|
|
@@ -38,6 +39,11 @@ class CLIParser
|
|
38
39
|
options.junit = junit
|
39
40
|
end
|
40
41
|
|
42
|
+
opts.on("--android_junit android_junit_output",
|
43
|
+
"Parse Android Junit output to res type") do |android_junit|
|
44
|
+
options.android_junit = android_junit
|
45
|
+
end
|
46
|
+
|
41
47
|
opts.on("--junitcasper junit_xml",
|
42
48
|
"Parse junit xml to res type") do |junitcasper|
|
43
49
|
options.junitcasper = junitcasper
|
@@ -112,6 +118,11 @@ if options.junitcasper
|
|
112
118
|
ir = Res::IR.load(junit_output.io)
|
113
119
|
end
|
114
120
|
|
121
|
+
if options.android_junit
|
122
|
+
android_junit_output = Res::Parsers::AndroidJunit.new(options.android_junit)
|
123
|
+
ir = Res::IR.load(android_junit_output.io)
|
124
|
+
end
|
125
|
+
|
115
126
|
raise "No results loaded" if !ir
|
116
127
|
|
117
128
|
if options.reporter
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'res/ir'
|
2
|
+
|
3
|
+
module Res
|
4
|
+
module Parsers
|
5
|
+
class AndroidJunit
|
6
|
+
attr_accessor :io
|
7
|
+
|
8
|
+
def initialize(instrument_output)
|
9
|
+
result = Array.new
|
10
|
+
result = parse(instrument_output)
|
11
|
+
ir = ::Res::IR.new( :type => 'AndroidJUnitRunner',
|
12
|
+
:started => "",
|
13
|
+
:finished => Time.now(),
|
14
|
+
:results => result
|
15
|
+
)
|
16
|
+
@io = File.open("./instruments.res", "w")
|
17
|
+
@io.puts ir.json
|
18
|
+
@io.close
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse(output)
|
22
|
+
class_name = Array.new
|
23
|
+
test = Array.new
|
24
|
+
result = Array.new
|
25
|
+
test = {
|
26
|
+
type: "AndroidJUnit::Test",
|
27
|
+
name: 'UNKNOWN',
|
28
|
+
status: "passed"
|
29
|
+
}
|
30
|
+
File.open(output) do |f|
|
31
|
+
f.each_line do |line|
|
32
|
+
if line.include?("INSTRUMENTATION_STATUS_CODE")
|
33
|
+
result.last[:children] << test
|
34
|
+
test = {
|
35
|
+
type: "AndroidJUnit::Test",
|
36
|
+
name: 'UNKNOWN',
|
37
|
+
status: "passed"
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
if line.include?("class")
|
42
|
+
line = line.gsub("INSTRUMENTATION_STATUS: class=", "").strip
|
43
|
+
if !class_name.include? line
|
44
|
+
class_name.push(line)
|
45
|
+
result << {
|
46
|
+
type: "AndroidJUnit::Class",
|
47
|
+
name: class_name.last,
|
48
|
+
children: Array.new
|
49
|
+
}
|
50
|
+
end
|
51
|
+
elsif line.include?("test=")
|
52
|
+
test[:name] = line.gsub("INSTRUMENTATION_STATUS: test=", "").strip
|
53
|
+
elsif line.include?("Error in ")
|
54
|
+
test[:status] = 'failed'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
result
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
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.2
|
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-02-
|
13
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/res/formatters/ruby_cucumber2.rb
|
101
101
|
- lib/res/ir.rb
|
102
102
|
- lib/res/mappings.rb
|
103
|
+
- lib/res/parsers/android_junit.rb
|
103
104
|
- lib/res/parsers/junit.rb
|
104
105
|
- lib/res/parsers/junitcasper.rb
|
105
106
|
- lib/res/reporters/hive.rb
|
@@ -125,9 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
128
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.5.0
|
129
130
|
signing_key:
|
130
131
|
specification_version: 4
|
131
132
|
summary: Test Result report libraries
|
132
133
|
test_files: []
|
133
|
-
has_rdoc:
|