res 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1faaf3f83f2032befcd21d325961900df987b67d
4
- data.tar.gz: c346637e360267722da74951ba8b97574933bc8a
3
+ metadata.gz: 57a6d7960a73b04fc8fbd1ceabc329dcea135f17
4
+ data.tar.gz: d8fbb6204ef84a204298eef60bfa39601491bcd3
5
5
  SHA512:
6
- metadata.gz: f6b8b77d0267f8682c050db1251959e594e3225f0b31bfa20ad600e657861a5106d5b2ca4c960569de4195d185e48c5bb67a0b7566905b69d990bfc9dfee418d
7
- data.tar.gz: eb60be622904ec78521e5680f5ff66448fb968937d9efd8c6edd485b9297e5630232523143a0a9590a63300ac9e6b10d815d3071fa0fb5f4efb31a24508b8638
6
+ metadata.gz: e387461aeb1c6c9d5d5cdad5c5477bd8ccd6d9200bd6c083f05f32a10c63d7492acdd3fa0596f00a862a15e57c5cdeef057ece8b2cb6f7657d59b0121dbaf7ee
7
+ data.tar.gz: b25530ad6a38fa06450909365de8ceb8d58ca6385473918cc34f3a6660c27f4978839f973db2cd79ccd024a6eff5337dd1da374c30b05404062f629cfde16a00
data/README.md CHANGED
@@ -35,13 +35,11 @@ You can dump a Res IR results file using a cucumber formatter or parse xunit out
35
35
 
36
36
  rspec -f Res::Formatters::Rspec -o ./rspec.res
37
37
 
38
- ## Junit
38
+ ## Android Junit (output from Instruments test), Junit and Casper
39
39
 
40
- res.rb --junit '/path/to/xunit_result.xml'
41
- Note: The Res output of the xunit parser is saved in the current directory
42
-
43
- ## Casper
44
- res.rb --junitcasper '/path/to/xunit_result.xml'
40
+ res --android_junit '/path/to/instruments.out'
41
+ res --junit '/path/to/xunit_result.xml'
42
+ res --junitcasper '/path/to/xunit_result.xml'
45
43
  Note: The Res output of the xunit parser is saved in the current directory
46
44
 
47
45
  ## Reporters
@@ -52,7 +50,7 @@ tool.
52
50
 
53
51
  If you have a Res IR file, you can submit using a reporter:
54
52
 
55
- res.rb --res '/path/to/file.res' --submit REPORTER [... options]
53
+ res --res '/path/to/file.res' --submit REPORTER [... options]
56
54
 
57
55
  ### Hive
58
56
 
@@ -67,7 +65,7 @@ Hive CI uses a Res reporter for result submission, the api arguments look like t
67
65
 
68
66
  ### TestRail
69
67
 
70
- res.rb --res '/path/to/file.res' --submit testrail --config-file '/path/to/.test_rail.yaml'
68
+ res --res '/path/to/file.res' --submit testrail --config-file '/path/to/.test_rail.yaml'
71
69
 
72
70
  Our TestRail reporter currently be used to sync a suite with TestRail, and
73
71
  to submit test results against a test run. You will need to create a
data/bin/res CHANGED
@@ -6,6 +6,7 @@ require 'res/ir'
6
6
  require 'res/reporters/testmine'
7
7
  require 'res/reporters/test_rail'
8
8
  require 'res/reporters/hive'
9
+ require 'res/reporters/lion'
9
10
  require 'res/parsers/junit'
10
11
  require 'res/parsers/android_junit'
11
12
  require 'res/parsers/junitcasper'
@@ -89,6 +90,11 @@ class CLIParser
89
90
  options.target = target
90
91
  end
91
92
 
93
+ opts.on_tail("-V", "--res_version", "Display the version of Res") do
94
+ puts Res::VERSION
95
+ exit
96
+ end
97
+
92
98
  opts.on_tail("-h", "--help", "Display help") do
93
99
  puts opts
94
100
  exit
@@ -158,6 +164,15 @@ if options.reporter
158
164
  :ir => ir
159
165
  )
160
166
 
167
+ output = reporter.submit_results(ir)
168
+ puts output
169
+ when 'lion'
170
+ reporter = Res::Reporters::Lion.new(
171
+ :config_file => options.config_file,
172
+ :url => options.url,
173
+ :ir => ir
174
+ )
175
+
161
176
  output = reporter.submit_results(ir)
162
177
  puts output
163
178
  else
data/lib/res.rb CHANGED
@@ -26,6 +26,11 @@ module Res
26
26
  when :testmine
27
27
  require 'res/reporters/testmine'
28
28
  Res::Reporters::Testmine
29
+ when :lion
30
+ require 'res/reporters/lion'
31
+ Res::Reporters::Lion
32
+ else
33
+ raise "Invalid Reporter type"
29
34
  end
30
35
  end
31
36
 
@@ -65,11 +65,11 @@ module Res
65
65
  set_status(result, test.metadata[:location], status)
66
66
  end
67
67
 
68
- def add_result(test)
69
- return {
70
- "type": "Rspec::Test",
71
- "name": test[:description],
72
- "urn": test[:location],
68
+ def add_result(test)
69
+ {
70
+ type: "Rspec::Test",
71
+ name: test[:description],
72
+ urn: test[:location]
73
73
  }
74
74
  end
75
75
 
@@ -123,7 +123,7 @@ module Res
123
123
  @ir = ::Res::IR.new( :type => 'Rspec',
124
124
  :started => @start_time,
125
125
  :results => result,
126
- :finished => Time.now(),
126
+ :finished => Time.now()
127
127
  )
128
128
  end
129
129
 
@@ -20,7 +20,7 @@ module Res
20
20
  create_multiple_test_suite(test_suites)
21
21
  end
22
22
  ir = ::Res::IR.new(:type => 'Casper',
23
- :started => "",
23
+ :started => Time.now(),
24
24
  :finished => Time.now(),
25
25
  :results => @test_suites
26
26
  )
@@ -0,0 +1,56 @@
1
+ require 'res/config'
2
+
3
+ module Res
4
+ module Reporters
5
+ class Lion
6
+
7
+ attr_accessor :url, :config
8
+
9
+ def initialize(args)
10
+ @url = args[:url]
11
+ @config = Res::Config.new([:url, :tag, :description, :app_name],
12
+ :optional => [:hive_job_id, :queue],
13
+ :pre_env => 'LION_')
14
+ config.process(args)
15
+ end
16
+
17
+ def submit_results(ir, args = nil)
18
+ status = "failed"
19
+ status = "passed" if ir.tests.count == ir.count(:passed)
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
+ # Set Lion Data
29
+ lion_data = {
30
+ :app_name => config.app_name,
31
+ :tag => config.tag,
32
+ :description => config.description,
33
+ :queue_name => ENV["HIVE_QUEUE_NAME"] || config.queue,
34
+ :type => ir.type,
35
+ :started => ir.results.first[:started],
36
+ :finished => ir.results.last[:finished],
37
+ :status => status,
38
+ :perf_values => values.compact!
39
+ }
40
+ uri = URI.parse(config.url)
41
+ net = Net::HTTP.new(uri.host, uri.port)
42
+ request = Net::HTTP::Post.new("/import")
43
+ request.set_form_data(lion_data)
44
+
45
+ net.read_timeout = 60
46
+ net.open_timeout = 10
47
+
48
+ response = net.start do |http|
49
+ http.request(request)
50
+ end
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,3 @@
1
+ module Res
2
+ VERSION = '1.2.3'
3
+ 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.2
4
+ version: 1.2.3
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-03 00:00:00.000000000 Z
13
+ date: 2016-02-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -104,8 +104,10 @@ files:
104
104
  - lib/res/parsers/junit.rb
105
105
  - lib/res/parsers/junitcasper.rb
106
106
  - lib/res/reporters/hive.rb
107
+ - lib/res/reporters/lion.rb
107
108
  - lib/res/reporters/test_rail.rb
108
109
  - lib/res/reporters/testmine.rb
110
+ - lib/res/version.rb
109
111
  homepage: https://github.com/bbc/res
110
112
  licenses:
111
113
  - MIT
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  version: '0'
127
129
  requirements: []
128
130
  rubyforge_project:
129
- rubygems_version: 2.5.0
131
+ rubygems_version: 2.4.5.1
130
132
  signing_key:
131
133
  specification_version: 4
132
134
  summary: Test Result report libraries