itriagetestrail 1.0.27 → 1.0.28

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
  SHA256:
3
- metadata.gz: 3604b9e84ffa8d74ffbd12bbb05a0a1f4b1926875b06ca6e27464928cdfa7c48
4
- data.tar.gz: 9c40d36124660392a66ade318778b64343947e0787f3d9252f6be7015b70dd0a
3
+ metadata.gz: 5cb7340d35c7a41c162505bb3df8702970e007c89c9f233d20868b1897a6768d
4
+ data.tar.gz: 6d4a1f6a6bc3aa5ddf71c8bdb81ddb1fe849ac9b621af1ec55794f1e3d4c12ba
5
5
  SHA512:
6
- metadata.gz: 0fc0833a7585ebe15e921f915dae4ccb1b1d1bbd312f12e82e437017f1e89eea01253bc5d88edafdb899e7a3f87f8115762684fcb97c7bc17004233b09b98e33
7
- data.tar.gz: cba944bc480c897efe5ac27f2472e10ea004e34cd55487ecbc72328b1be9462ea2bf6bf1e5562a89a34e2daab22ded7a235c6e1adb09fc681995868481cd5069
6
+ metadata.gz: f7ec0e1d1a915c81fa4b0f24caafe6c9c1fb54869e6d0b95e15a35fb0e9122cc7d2223950d3cb346cad6f31d1762ed22839da4ab3be0675938aa85f508edf567
7
+ data.tar.gz: 64fae936833ee725633cac62f4af98ca0ff70375486e92dba6b0316e0fb8eb736bef667f7b184adf59f1860c692dfff4d68725ee29744a83c0c0ba1f941ea66a
@@ -113,7 +113,7 @@ module TestRail
113
113
  response = conn.request(request)
114
114
  @response_code = response.code
115
115
  if @response_code == '429'
116
- write_status_to_file('testrail_429s', url)
116
+ write_http_status_to_file('testrail_429s', url)
117
117
  sleep(response.header['retry-after'].to_i)
118
118
  elsif @response_code == '500'
119
119
  puts response.to_s
@@ -121,7 +121,7 @@ module TestRail
121
121
  # trying to get lock; try restarting transaction'
122
122
  sleep(2)
123
123
  else
124
- write_status_to_file('testrail_200s', url)
124
+ write_http_status_to_file('testrail_200s', url)
125
125
  break
126
126
  end
127
127
  retry_count += 1
@@ -135,7 +135,7 @@ module TestRail
135
135
  end
136
136
 
137
137
  # This method is only used publicly
138
- def write_status_to_file(filename, endpoint)
138
+ def write_http_status_to_file(filename, endpoint)
139
139
  Dir.mkdir('./tmp') unless File.exist?('./tmp')
140
140
  file = File.open("./tmp/#{filename}", 'a')
141
141
  file.write("#{Time.now},#{endpoint}\n")
@@ -16,6 +16,48 @@ 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
+ Dir.mkdir('./tmp/batch') unless File.exist?('./tmp/batch')
28
+ file = File.open("./tmp/batch/#{@run_id}", 'a')
29
+ file.write("#{entry}\n")
30
+ file.close
31
+ end
32
+
33
+ # Use this method to read bulk records of results stored in the temp file, and send entire set as a
34
+ # post execution batch.
35
+ def send_batch_results_to_testrail
36
+ content = read_batch_file
37
+ begin
38
+ send = { results: content[:results] }
39
+ @client.send_post("add_results_for_cases/#{content[:runId]}", send)
40
+ clear_results
41
+ rescue StandardError => e
42
+ raise e
43
+ end
44
+ end
45
+
46
+ def read_batch_file
47
+ return unless File.exist?('./tmp/batch')
48
+ run_id = nil
49
+ results = []
50
+ File.open("./tmp/batch").each do |line|
51
+ content = eval(line)
52
+ unless run_id
53
+ run_id = content[:runId]
54
+ puts run_id
55
+ end
56
+ content[:results].each { |result| results << result }
57
+ end
58
+ {runId: run_id, results: results}
59
+ end
60
+
19
61
  def update_test_suite(scenario_title, external_id, scenario_steps)
20
62
  feature = external_id.split(';')[0].split('#')[0]
21
63
 
@@ -37,6 +79,8 @@ module Itriagetestrail
37
79
  associate_result(external_id)
38
80
  end
39
81
 
82
+ # Called during after_teardown, this saves the result of the test method or scenario
83
+ # into local memory for later processing
40
84
  def store_result(scenario_title, external_id, scenario_steps, status_id, comment)
41
85
  update_test_suite scenario_title, external_id, scenario_steps
42
86
 
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '1.0.27'.freeze
2
+ VERSION = '1.0.28'.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.27
4
+ version: 1.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-06 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