gridium 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Rakefile +3 -1
- data/lib/gridium/version.rb +1 -1
- data/lib/testrail.rb +41 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d996e7c1fc5e700bf68f655503ef6e2eb3c6fd
|
4
|
+
data.tar.gz: b3c5bfdb542a3bcaa0b98723401a2fab985d6b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89978028aed88aed4c75d2d379daed93fcb86b6b9f4fc74dfe5a58cfbf940827211b6125192d496ec88aec37c8704288a55c62ed0c167af31e47a8cd125c637
|
7
|
+
data.tar.gz: f933eca0a1ad6bd394cf9f56228162550b5368d17eed12a7713798d9bcad3f8e065d19796ea9205201d695f402fcc9f2031f498cd5c7a5d52ee6f49474f67682
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/lib/gridium/version.rb
CHANGED
data/lib/testrail.rb
CHANGED
@@ -20,6 +20,8 @@ module Gridium
|
|
20
20
|
@user = ENV['GRIDIUM_TR_USER'].empty? || ENV['GRIDIUM_TR_USER'].nil? ? ENV_ERROR : ENV['GRIDIUM_TR_USER']
|
21
21
|
@password = ENV['GRIDIUM_TR_PW'].empty? || ENV['GRIDIUM_TR_PW'].nil? ? ENV_ERROR : ENV['GRIDIUM_TR_PW']
|
22
22
|
@pid = ENV['GRIDIUM_TR_PID'].empty? || ENV['GRIDIUM_TR_PID'].nil? ? ENV_ERROR : ENV['GRIDIUM_TR_PID']
|
23
|
+
@testcase_ids = Array.new
|
24
|
+
@testcase_infos = Array.new
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -37,44 +39,48 @@ module Gridium
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
status = FAILED
|
59
|
-
message = rspec_test.exception.message
|
60
|
-
else
|
61
|
-
status = PASSED
|
62
|
-
message = ''
|
63
|
-
end
|
64
|
-
r = _send_request(
|
65
|
-
'POST',
|
66
|
-
"add_result_for_case/#{@runid}/#{rspec_test.metadata[:testrail_id]}",
|
67
|
-
status_id: status,
|
68
|
-
comment: message
|
69
|
-
)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
42
|
+
def add_case(rspec_test)
|
43
|
+
if Gridium.config.testrail
|
44
|
+
Log.debug("[GRIDIUM::TestRail] Adding to list of TestRail Cases...")
|
45
|
+
if rspec_test.nil? then
|
46
|
+
Log.error("[GRIDIUM::TestRail] No test added to results. Turn of Gridium.config.testrail\n")
|
47
|
+
end
|
48
|
+
if rspec_test.exception
|
49
|
+
status = FAILED
|
50
|
+
message = rspec_test.exception.message
|
51
|
+
else
|
52
|
+
status = PASSED
|
53
|
+
message = 'Test Passed.'
|
54
|
+
end
|
55
|
+
test_info = {:trid => rspec_test.metadata[:testrail_id], :status_id => status, :message => message}
|
56
|
+
@testcase_infos.push(test_info)
|
57
|
+
@testcase_ids.push(test_info[:trid])
|
58
|
+
end
|
59
|
+
end
|
73
60
|
|
61
|
+
def close_run
|
62
|
+
if Gridium.config.testrail
|
63
|
+
Log.debug("[GRIDIUM::TestRail] Closing test runid: #{@runid}\n")
|
64
|
+
unless @runid.nil?
|
65
|
+
r = _send_request('POST', "update_run/#{@runid}", {:case_ids => @testcase_ids})
|
66
|
+
@testcase_infos.each do |tc|
|
67
|
+
r = _send_request(
|
68
|
+
'POST',
|
69
|
+
"add_result_for_case/#{@runid}/#{tc[:trid]}",
|
70
|
+
status_id: tc[:status_id],
|
71
|
+
comment: tc[:message]
|
72
|
+
)
|
73
|
+
sleep(0.25)
|
74
|
+
end
|
75
|
+
r = _send_request('POST', "close_run/#{@runid}", nil)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
74
79
|
|
75
80
|
private
|
76
81
|
def _send_request(method, uri, data)
|
77
82
|
url = URI.parse(@url + uri)
|
83
|
+
Log.debug("[GRIDIUM::TestRail] Method: #{method} URL:#{uri} Data:#{data}")
|
78
84
|
if method == 'POST'
|
79
85
|
request = Net::HTTP::Post.new(url.path + '?' + url.query)
|
80
86
|
request.body = JSON.dump(data)
|
@@ -90,7 +96,6 @@ module Gridium
|
|
90
96
|
conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
91
97
|
end
|
92
98
|
response = conn.request(request)
|
93
|
-
|
94
99
|
if response.body && !response.body.empty?
|
95
100
|
result = JSON.parse(response.body)
|
96
101
|
else
|
@@ -98,11 +103,13 @@ module Gridium
|
|
98
103
|
end
|
99
104
|
|
100
105
|
if response.code != '200'
|
106
|
+
|
101
107
|
if result && result.key?('error')
|
102
108
|
error = '"' + result['error'] + '"'
|
103
109
|
else
|
104
110
|
error = 'No additional error message received'
|
105
111
|
end
|
112
|
+
Log.debug("[GRIDIUM::TestRail] Error with request: #{error}")
|
106
113
|
raise APIError.new('TestRail API returned HTTP %s (%s)' %
|
107
114
|
[response.code, error])
|
108
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Urban
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|