itriagetestrail 1.0.24 → 1.0.30

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
- SHA1:
3
- metadata.gz: c3b6e074275e751bfbd87ff98612abaae638f5dd
4
- data.tar.gz: b848b3e5ccdd448e0657bb8af3a880cbde039d51
2
+ SHA256:
3
+ metadata.gz: f9c2598f1f48638196f167848fe54f68852fb6834a885ea248a6e4c954d052a6
4
+ data.tar.gz: fcf15ba7fd2d2475865e9057c60febe4cef4713afb66dfcc1db2aae75a22c60b
5
5
  SHA512:
6
- metadata.gz: b17a29abdd9529a1d320fdde01a479defba5e2b441339f76f746a157a100ff5b08d49729c1f0ca267c1ff0636548dd25e10d5dadf8114f7c0f35579989182dee
7
- data.tar.gz: 14e2ed33864792fab26e62a987dd41329b3761252c04915a5e39c1d61d579f6532ac380a31a86f0709c5abf3ef7b4a49f271c23b1d45d479a4d9ba8996ce02e0
6
+ metadata.gz: e6385187bc0a55a7b1c4b12a3aa51515b7b19bb9f6b0d283466c6ebffa2436267937c68ab24ba2523732a369fe88105361b9b0b880ccdd94445181a307627cf8
7
+ data.tar.gz: 870b45e4257f79456864ad553b7b9576f1d52f235dd13d6ed802a6b0b2d1e290888c0cb22dafafb4411bc254f66f8422982cfc160ad9b849dcb0cffe681386c3
@@ -48,8 +48,7 @@ module Itriagetestrail
48
48
  def testrail_online
49
49
  # This is the very first call to TestRail
50
50
  make_connection
51
- @client.send_get('get_projects')
52
-
51
+ projects
53
52
  if @client.response_code == '200'
54
53
  true
55
54
  else
@@ -113,6 +113,7 @@ module TestRail
113
113
  response = conn.request(request)
114
114
  @response_code = response.code
115
115
  if @response_code == '429'
116
+ write_http_status_to_file('testrail_429s', url)
116
117
  sleep(response.header['retry-after'].to_i)
117
118
  elsif @response_code == '500'
118
119
  puts response.to_s
@@ -120,6 +121,7 @@ module TestRail
120
121
  # trying to get lock; try restarting transaction'
121
122
  sleep(2)
122
123
  else
124
+ write_http_status_to_file('testrail_200s', url)
123
125
  break
124
126
  end
125
127
  retry_count += 1
@@ -131,6 +133,14 @@ module TestRail
131
133
 
132
134
  result
133
135
  end
136
+
137
+ # This method is only used publicly
138
+ def write_http_status_to_file(filename, endpoint)
139
+ Dir.mkdir('./tmp') unless File.exist?('./tmp')
140
+ file = File.open("./tmp/#{filename}", 'a')
141
+ file.write("#{Time.now},#{endpoint}\n")
142
+ file.close
143
+ end
134
144
  end
135
145
 
136
146
  class APIError < StandardError
@@ -16,6 +16,52 @@ module Itriagetestrail
16
16
  end
17
17
  end
18
18
 
19
+ # In implementations where there is not an at_exit, parallel test threads can store results
20
+ # of tests from the completed test class into a batch file, so final processing sends all results
21
+ # at the very end of the job while avoiding rate limiting issues.
22
+ def store_results_to_batch_file
23
+ return if @results[:results].empty?
24
+ entry = {runId: @run_id, results: @results[:results]}
25
+
26
+ Dir.mkdir('./tmp') unless File.exist?('./tmp')
27
+ file = File.open("./tmp/batch", 'a')
28
+ file.write("#{entry}\n")
29
+ file.close
30
+
31
+ # keep track of what is submitted
32
+ @submitted[:results] << @results[:results]
33
+
34
+ # clear the buffer for next class
35
+ @results[:results] = []
36
+ end
37
+
38
+ # Use this method to read bulk records of results stored in the temp file, and send entire set as a
39
+ # post execution batch.
40
+ def send_batch_results_to_testrail
41
+ content = read_batch_file
42
+ begin
43
+ send = { results: content[:results] }
44
+ @client.send_post("add_results_for_cases/#{content[:runId]}", send)
45
+ clear_results
46
+ rescue StandardError => e
47
+ raise e
48
+ end
49
+ end
50
+
51
+ def read_batch_file
52
+ return unless File.exist?('./tmp/batch')
53
+ run_id = nil
54
+ results = []
55
+ File.open("./tmp/batch").each do |line|
56
+ content = eval(line)
57
+ unless run_id
58
+ run_id = content[:runId]
59
+ end
60
+ content[:results].each { |result| results << result }
61
+ end
62
+ {runId: run_id, results: results}
63
+ end
64
+
19
65
  def update_test_suite(scenario_title, external_id, scenario_steps)
20
66
  feature = external_id.split(';')[0].split('#')[0]
21
67
 
@@ -37,6 +83,8 @@ module Itriagetestrail
37
83
  associate_result(external_id)
38
84
  end
39
85
 
86
+ # Called during after_teardown, this saves the result of the test method or scenario
87
+ # into local memory for later processing
40
88
  def store_result(scenario_title, external_id, scenario_steps, status_id, comment)
41
89
  update_test_suite scenario_title, external_id, scenario_steps
42
90
 
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '1.0.24'.freeze
2
+ VERSION = '1.0.30'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itriagetestrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.24
4
+ version: 1.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.5.2.3
123
+ rubygems_version: 3.0.3
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Plugin to export your cucumber tests in the Testrail