itriagetestrail 1.0.23 → 1.0.29
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 898fa6b771b837a565622643331fb0e7bb002e158902e02f63d45850d052753c
|
4
|
+
data.tar.gz: c42798bc295c0c385ca0b710fde77f94fab90497c36d638175ed560237a951dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c01636f49eb622acf4d068c6c52360c09d1ad3c1a88cfaa41f617ae5db5f47466653ed4b0ba5ad9cb19321c75818030d9ec65bef5342b11cd056d3dd18d2df
|
7
|
+
data.tar.gz: 89cca8f3fc18e6c862d8804247a79c3b962b0539a74a573c18d225124956de879c23ee201aac52655c8cb3324897465a3a11462cc798632b2333da14cfad25a9
|
data/lib/itriagetestrail.rb
CHANGED
@@ -48,9 +48,8 @@ module Itriagetestrail
|
|
48
48
|
def testrail_online
|
49
49
|
# This is the very first call to TestRail
|
50
50
|
make_connection
|
51
|
-
|
52
|
-
|
53
|
-
if @client.response_code == '200'
|
51
|
+
projects
|
52
|
+
if @projects.response_code == '200'
|
54
53
|
true
|
55
54
|
else
|
56
55
|
puts "**** TESTRAIL IS OFFLINE for maintenance or other reason with status code #{@client.response_code}"
|
@@ -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
|
|
@@ -29,11 +75,16 @@ module Itriagetestrail
|
|
29
75
|
|
30
76
|
add_testrail_test_case(scenario_title, external_id, scenario_steps, section_id)
|
31
77
|
sleep 1
|
78
|
+
|
79
|
+
# Update Test Run
|
80
|
+
extend_testrail_run
|
32
81
|
end
|
33
82
|
# store the case id associated with the external_id
|
34
83
|
associate_result(external_id)
|
35
84
|
end
|
36
85
|
|
86
|
+
# Called during after_teardown, this saves the result of the test method or scenario
|
87
|
+
# into local memory for later processing
|
37
88
|
def store_result(scenario_title, external_id, scenario_steps, status_id, comment)
|
38
89
|
update_test_suite scenario_title, external_id, scenario_steps
|
39
90
|
|
@@ -75,9 +126,6 @@ module Itriagetestrail
|
|
75
126
|
@client.send_post("update_case/#{case_id}", { 'custom_tags': scenario_tag_ids, 'custom_steps': @scenario_steps})
|
76
127
|
end
|
77
128
|
end
|
78
|
-
|
79
|
-
# Update Test Run
|
80
|
-
extend_testrail_run
|
81
129
|
end
|
82
130
|
end
|
83
131
|
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.
|
4
|
+
version: 1.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a801069
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
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
|
-
|
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
|