res 1.2.17 → 1.2.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e495d9220fa374e9c75cf6f694ada1608b8f2fbf
4
- data.tar.gz: c6011b3ced7ae736c19486c0bd91d606dcf3252f
3
+ metadata.gz: 5d84c2835ecad3685cf33e38756fc5c788aca5fe
4
+ data.tar.gz: 90b25f6a7c9911b2c9680ebc87149496fa9c9b1d
5
5
  SHA512:
6
- metadata.gz: 2c1d96c99304680bc61fbb37185758459963743db25a4d90c43055245eeab8394d0f1adb1c55ba53638c02701e9f3883c68f54cc00d74144b4313ac72c515915
7
- data.tar.gz: db38fc0d05955a148f63579a343345db7810ef0faad169951cc6b6ac1ef3d73dd537e0d0ca42fa7bdd3d70749e0d7e5d370dc94523d42efd256a38fa04dd4a8f
6
+ metadata.gz: 66f7f218e8891dfe47b7943347df6e0fe623ec7afaee1c2e21c6489b2fb472ba56d9eee928b5cf047cbefb8d7211b233ca29079cca83e052f71224a8fcd184d8
7
+ data.tar.gz: dddc9532fc982374c784cc0cc18f417bae986db4eb6ada0fd41b6a1ab8e1ea59282c7abc90aa0be9ec1054df07095706e1d2eb5e2f4ca445792177f8dd49521a
data/README.md CHANGED
@@ -92,7 +92,7 @@ require you to sync your test definitions before you submit a run.
92
92
  You need to create a project file in the root of your test code, the file
93
93
  should be called .testmine.yaml, and should look like this:
94
94
 
95
- testmine_url: 'mytestmineinstance.bbc.co.uk'
95
+ url: 'mytestmineinstance.bbc.co.uk'
96
96
  authentication: 'authenticationkey'
97
97
  project: 'MyProjectName'
98
98
  component: 'Android acceptance'
data/bin/res CHANGED
@@ -148,13 +148,15 @@ if options.reporter
148
148
  when 'testmine'
149
149
 
150
150
  reporter = Res::Reporters::Testmine.new(
151
- :config_file => options.config_file,
152
- :url => options.url,
153
- :cert => options.cert,
154
- :cacert => options.cacert,
155
- :target => options.target,
156
- :ssl_verify_mode => options.ssl_verify_mode,
157
- :ir => ir
151
+ :config_file => options.config_file,
152
+ :url => options.url,
153
+ :cert => options.cert,
154
+ :cacert => options.cacert,
155
+ :version => options.version,
156
+ :target => options.target,
157
+ :hive_job_id => options.job_id,
158
+ :ssl_verify_mode => options.ssl_verify_mode,
159
+ :ir => ir
158
160
  )
159
161
 
160
162
  id = reporter.submit_results(ir)
@@ -18,6 +18,10 @@ module Res
18
18
  end
19
19
 
20
20
  def parse(output)
21
+ test_complete = false
22
+ total_tests = 0
23
+ passed = 0
24
+ failed = 0
21
25
  class_name = []
22
26
  result = []
23
27
  test = {
@@ -28,41 +32,63 @@ module Res
28
32
 
29
33
  File.open(output) do |f|
30
34
  f.each_line do |line|
35
+ if !line.match('INSTRUMENTATION_RESULT') && !test_complete
31
36
 
32
- if line.match('INSTRUMENTATION_STATUS_CODE: (.*)$')
33
- case Regexp.last_match[1].strip
34
- when '1'
35
- # Skip if this is just the 'pre-run' test
36
- next
37
- when '0'
38
- test[:status] = 'passed'
39
- when '-2'
40
- test[:status] = 'failed'
41
- else
42
- test[:status] = 'unknown'
43
- end
44
- result.last[:children] << test
45
- test = {
46
- type: 'AndroidJUnit::Test',
47
- name: 'UNKNOWN',
48
- status: 'unknown'
49
- }
50
- end
37
+ if line.match('INSTRUMENTATION_STATUS: numtests=(.*)$')
38
+ total_tests = Regexp.last_match[1].to_i
39
+ end
51
40
 
52
- if line.include?('class')
53
- line = line.gsub('INSTRUMENTATION_STATUS: class=', '').strip
54
- unless class_name.include? line
55
- class_name.push(line)
56
- result << {
57
- type: 'AndroidJUnit::Class',
58
- name: class_name.last,
59
- children: Array.new
41
+ if line.match('INSTRUMENTATION_STATUS_CODE: (.*)$')
42
+ case Regexp.last_match[1].strip
43
+ when '1'
44
+ # Skip if this is just the 'pre-run' test
45
+ next
46
+ when '0'
47
+ test[:status] = 'passed'
48
+ passed += 1
49
+ when '-2'
50
+ test[:status] = 'failed'
51
+ else
52
+ test[:status] = 'unknown'
53
+ end
54
+ result.last[:children] << test
55
+ test = {
56
+ type: 'AndroidJUnit::Test',
57
+ name: 'UNKNOWN',
58
+ status: 'unknown'
60
59
  }
61
60
  end
62
- elsif line.include?('test=')
63
- test[:name] = line.gsub('INSTRUMENTATION_STATUS: test=', '').strip
64
- elsif line.include?('Error in ')
65
- test[:status] = 'failed'
61
+
62
+ if line.include?('class=')
63
+ line = line.gsub('INSTRUMENTATION_STATUS: class=', '').strip
64
+ unless class_name.include? line
65
+ class_name.push(line)
66
+ result << {
67
+ type: 'AndroidJUnit::Class',
68
+ name: class_name.last,
69
+ children: Array.new
70
+ }
71
+ end
72
+ elsif line.include?('test=')
73
+ test[:name] = line.gsub('INSTRUMENTATION_STATUS: test=', '').strip
74
+ elsif line.include?('Error in ')
75
+ test[:status] = 'failed'
76
+ end
77
+
78
+ else
79
+
80
+ if line.match('Tests run: (.*), Failures: (.*)$')
81
+ failed = Regexp.last_match[2].to_i
82
+ if total_tests != (passed + failed)
83
+ result << {
84
+ type: 'AndroidJUnit::Exception',
85
+ name: 'Exception(s): Check in logs for more info',
86
+ status: 'UNKNOWN'
87
+ }
88
+ end
89
+ end
90
+ test_complete = true
91
+
66
92
  end
67
93
  end
68
94
  end
@@ -8,8 +8,8 @@ module Res
8
8
 
9
9
  def initialize(args)
10
10
  @url = args[:url]
11
- @config = Res::Config.new([:project, :component, :suite, :url],
12
- :optional => [:hive_job_id, :version, :target, :cert, :cacert, :ssl_verify_mode],
11
+ @config = Res::Config.new([:project, :component, :suite, :url, :target, :version],
12
+ :optional => [:hive_job_id, :cert, :cacert, :ssl_verify_mode],
13
13
  :pre_env => 'TESTMINE_')
14
14
  config.process(args)
15
15
  end
@@ -44,8 +44,8 @@ module Res
44
44
  request = Net::HTTP::Post.new(config.url + "/api/v1/submit")
45
45
  request.content_type = 'application/json'
46
46
  request.set_form_data({"data" => ir.to_json})
47
- @http.request(request)
48
-
47
+ response = @http.request(request)
48
+ response.body
49
49
  end
50
50
 
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module Res
2
- VERSION = '1.2.17'
2
+ VERSION = '1.2.18'
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.17
4
+ version: 1.2.18
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: 2017-01-05 00:00:00.000000000 Z
13
+ date: 2017-01-27 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.1
131
+ rubygems_version: 2.6.8
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Test Result report libraries