atm_ruby 0.1.18 → 0.1.19
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 +4 -4
- data/lib/atm_ruby/client.rb +15 -6
- data/lib/atm_ruby/error_handeling/test_case_error.rb +1 -1
- data/lib/atm_ruby/error_handeling/test_plan_error.rb +4 -4
- data/lib/atm_ruby/error_handeling/test_run_error.rb +1 -1
- data/lib/atm_ruby/helpers/base_service.rb +7 -3
- data/lib/atm_ruby/services/test_case.rb +29 -29
- data/lib/atm_ruby/services/test_plan.rb +2 -2
- data/lib/atm_ruby/services/test_run.rb +21 -21
- data/lib/atm_ruby/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d531d4d86bde54b7689c0e062f72e9039f4c8e67
|
4
|
+
data.tar.gz: f6074690939e105e22b2a83917e5151efc815332
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 499a411dfeb18ca68bdffbebc73b58ec2acbe97c6f62a1b493710e0af33fc2965c11dc4afedf75f325d42f23f150d6a4d7ac8be91b02695f708ed787acbfc008
|
7
|
+
data.tar.gz: bac6dd0a65ad90fdedfa9605b31cafc981bf8d0db06fd405c0f70bb8257c9662d77a4fd9156dcbd9694ac0a1bccdc93960b4cc2d2409ec6e1a22c7fc8f0c3570
|
data/lib/atm_ruby/client.rb
CHANGED
@@ -5,12 +5,13 @@ module ATM
|
|
5
5
|
class Client
|
6
6
|
attr_accessor :auth_header
|
7
7
|
|
8
|
-
def initialize(**
|
9
|
-
options = ATM.config.to_hash.merge(
|
8
|
+
def initialize(**options)
|
9
|
+
options = ATM.config.to_hash.merge(options)
|
10
10
|
options.each do |key, value|
|
11
11
|
singleton_class.class_eval { attr_accessor key }
|
12
12
|
send("#{key}=", value)
|
13
13
|
end
|
14
|
+
|
14
15
|
case options[:auth_type]
|
15
16
|
when :basic then @auth_header = set_access_token
|
16
17
|
else raise 'Currently only supports basic authentication'
|
@@ -31,13 +32,21 @@ module ATM
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def TestCase
|
34
|
-
ATM::Services::TestCase.new(
|
35
|
-
|
35
|
+
ATM::Services::TestCase.new(
|
36
|
+
auth_header: auth_header,
|
37
|
+
base_url: base_url,
|
38
|
+
environment: environment,
|
39
|
+
project_id: project_id
|
40
|
+
)
|
36
41
|
end
|
37
42
|
|
38
43
|
def TestRun
|
39
|
-
ATM::Services::TestRun.new(
|
40
|
-
|
44
|
+
ATM::Services::TestRun.new(
|
45
|
+
auth_header: auth_header,
|
46
|
+
base_url: base_url,
|
47
|
+
environment: environment,
|
48
|
+
test_run_id: test_run_id
|
49
|
+
)
|
41
50
|
end
|
42
51
|
end # Client
|
43
52
|
end # ATM
|
@@ -6,10 +6,10 @@ module ATM
|
|
6
6
|
|
7
7
|
def initialize(response)
|
8
8
|
@response = response
|
9
|
-
@message = case response.code
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
@message = case @response.code
|
10
|
+
when 401 then raise_401
|
11
|
+
when 404 then raise_404('No Test Plan has been found with the given key')
|
12
|
+
when 500 then raise_500
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -18,9 +18,13 @@ module ATM
|
|
18
18
|
attr_reader :auth_header, :response
|
19
19
|
def_delegators :@response, :code, :body, :header
|
20
20
|
|
21
|
-
def initialize(**
|
22
|
-
self.class.base_uri
|
23
|
-
@auth_header =
|
21
|
+
def initialize(**options)
|
22
|
+
self.class.base_uri options[:base_url]
|
23
|
+
@auth_header = options[:auth_header]
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_response(new_response)
|
27
|
+
@response = new_response
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -10,10 +10,10 @@ module ATM
|
|
10
10
|
|
11
11
|
attr_accessor :environment, :project_id
|
12
12
|
|
13
|
-
def initialize(**
|
14
|
-
@project_id =
|
15
|
-
@environment =
|
16
|
-
super(
|
13
|
+
def initialize(**options)
|
14
|
+
@project_id = options.delete(:project_id)
|
15
|
+
@environment = options.delete(:environment)
|
16
|
+
super(options)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Creates new test case
|
@@ -24,47 +24,47 @@ module ATM
|
|
24
24
|
# ATM::Client.new.TestCase.create({"projectKey": "JQA", "name": "Ensure the axial-flow pump is enabled"})
|
25
25
|
#
|
26
26
|
def create(body)
|
27
|
-
self.class.post('/rest/kanoahtests/1.0/testcase', body: body.to_json, headers: auth_header).tap do |
|
28
|
-
|
27
|
+
self.class.post('/rest/kanoahtests/1.0/testcase', body: body.to_json, headers: auth_header).tap do |res|
|
28
|
+
set_response(res)
|
29
29
|
raise ATM::TestCaseError, response unless code == 201
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
# Updates test case
|
34
34
|
#
|
35
|
-
# @param [String]
|
35
|
+
# @param [String] test_case_id
|
36
36
|
#
|
37
37
|
# @example Update existing test case
|
38
38
|
#
|
39
39
|
def update(test_case_id, body)
|
40
|
-
self.class.put("/rest/kanoahtests/1.0/testcase/#{test_case_id}", body: body.to_json, headers: auth_header).tap do |
|
41
|
-
|
40
|
+
self.class.put("/rest/kanoahtests/1.0/testcase/#{test_case_id}", body: body.to_json, headers: auth_header).tap do |res|
|
41
|
+
set_response(res)
|
42
42
|
raise ATM::TestCaseError, response unless code == 200
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
# Deletes test case
|
47
47
|
#
|
48
|
-
# @param [String]
|
48
|
+
# @param [String] test_case_id
|
49
49
|
#
|
50
50
|
# @example Delete existing test case
|
51
51
|
#
|
52
52
|
def delete(test_case_id)
|
53
|
-
self.class.delete("/rest/kanoahtests/1.0/testcase/#{test_case_id}", headers: auth_header).tap do |
|
54
|
-
|
53
|
+
self.class.delete("/rest/kanoahtests/1.0/testcase/#{test_case_id}", headers: auth_header).tap do |res|
|
54
|
+
set_response(res)
|
55
55
|
raise ATM::TestCaseError, response unless code == 204
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
# Finds specific test case
|
60
60
|
#
|
61
|
-
# @param [String]
|
61
|
+
# @param [String] test_case_id
|
62
62
|
#
|
63
63
|
# @example Find existing test case
|
64
64
|
#
|
65
65
|
def find(test_case_id)
|
66
|
-
self.class.get("/rest/kanoahtests/1.0/testcase/#{test_case_id}", headers: auth_header).tap do |
|
67
|
-
|
66
|
+
self.class.get("/rest/kanoahtests/1.0/testcase/#{test_case_id}", headers: auth_header).tap do |res|
|
67
|
+
set_response(res)
|
68
68
|
raise ATM::TestCaseError, response unless code == 200
|
69
69
|
end
|
70
70
|
end
|
@@ -76,8 +76,8 @@ module ATM
|
|
76
76
|
# @example Search for an existed test case
|
77
77
|
#
|
78
78
|
def search(query_string)
|
79
|
-
self.class.get("/rest/kanoahtests/1.0/testcase/search?query=#{query_string}", headers: auth_header).tap do |
|
80
|
-
|
79
|
+
self.class.get("/rest/kanoahtests/1.0/testcase/search?query=#{query_string}", headers: auth_header).tap do |res|
|
80
|
+
set_response(res)
|
81
81
|
raise ATM::TestCaseError, response unless code == 200
|
82
82
|
end
|
83
83
|
end
|
@@ -90,7 +90,7 @@ module ATM
|
|
90
90
|
#
|
91
91
|
def add_attachment(_test_case_id) # TODO: need to fix this.
|
92
92
|
warn 'Not implemented at the moment'
|
93
|
-
# self.class.get("/rest/kanoahtests/1.0/testcase/#{test_case_id}/attachment", headers: auth_header).tap do |
|
93
|
+
# self.class.get("/rest/kanoahtests/1.0/testcase/#{test_case_id}/attachment", headers: auth_header).tap do |res|
|
94
94
|
# raise ATM::TestCaseError, response unless response.code == 201
|
95
95
|
# end
|
96
96
|
end
|
@@ -104,8 +104,8 @@ module ATM
|
|
104
104
|
# ATM::Client.new.TestCase.create_new_test_result(test_data)
|
105
105
|
#
|
106
106
|
def create_new_test_result(test_data)
|
107
|
-
self.class.post('/rest/kanoahtests/1.0/testresult', body: test_data.to_json, headers: auth_header).tap do |
|
108
|
-
|
107
|
+
self.class.post('/rest/kanoahtests/1.0/testresult', body: test_data.to_json, headers: auth_header).tap do |res|
|
108
|
+
set_response(res)
|
109
109
|
raise ATM::TestCaseError, response unless code == 200
|
110
110
|
end
|
111
111
|
end
|
@@ -115,15 +115,15 @@ module ATM
|
|
115
115
|
# @param [Hash] test_data
|
116
116
|
def process_result(test_data)
|
117
117
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
118
|
+
'projectKey' => test_data.fetch(:project_id, project_id),
|
119
|
+
'testCaseKey' => test_data[:test_case_id],
|
120
|
+
'status' => test_data.fetch(:status, nil),
|
121
|
+
'environment' => test_data.fetch(:environment, environment),
|
122
|
+
'userKey' => test_data.fetch(:username, nil),
|
123
|
+
'comment' => test_data.fetch(:comment, nil),
|
124
|
+
'executionTime' => test_data.fetch(:execution_time, nil),
|
125
|
+
'executionDate' => test_data.fetch(:execution_date, nil),
|
126
|
+
'scriptResults' => test_data.fetch(:script_results, nil)
|
127
127
|
}.delete_if { |_k, v| v.nil? }
|
128
128
|
end
|
129
129
|
end
|
@@ -9,8 +9,8 @@ module ATM
|
|
9
9
|
# @example Retrive data for a plan_key
|
10
10
|
# plan_data = ATM::CLinet.new.TestPlan.find('RR-P20')
|
11
11
|
def find(plan_key)
|
12
|
-
self.class.get("/rest/kanoahtests/1.0/testplan/#{plan_key.upcase}", headers: auth_header).tap do |
|
13
|
-
|
12
|
+
self.class.get("/rest/kanoahtests/1.0/testplan/#{plan_key.upcase}", headers: auth_header).tap do |res|
|
13
|
+
set_response(res)
|
14
14
|
raise ATM::TestPlanError, response unless response.code == 200
|
15
15
|
end
|
16
16
|
end
|
@@ -7,10 +7,10 @@ module ATM
|
|
7
7
|
class TestRun < ATM::Services::Base
|
8
8
|
attr_reader :test_run_id, :environment
|
9
9
|
|
10
|
-
def initialize(**
|
11
|
-
@test_run_id =
|
12
|
-
@environment =
|
13
|
-
super(
|
10
|
+
def initialize(**options)
|
11
|
+
@test_run_id = options.delete(:test_run_id)
|
12
|
+
@environment = options.delete(:environment)
|
13
|
+
super(options)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Creates new test run
|
@@ -21,8 +21,8 @@ module ATM
|
|
21
21
|
# ATM::Client.new.TestRun.create({"name": "Full regression","projectKey": "JQA"})
|
22
22
|
#
|
23
23
|
def create(test_run_data)
|
24
|
-
self.class.post("/rest/kanoahtests/1.0/testrun", body: test_run_data.to_json, headers: auth_header).tap do |
|
25
|
-
|
24
|
+
self.class.post("/rest/kanoahtests/1.0/testrun", body: test_run_data.to_json, headers: auth_header).tap do |res|
|
25
|
+
set_response(res)
|
26
26
|
raise ATM::TestRunError, response unless code == 201
|
27
27
|
end
|
28
28
|
end
|
@@ -35,8 +35,8 @@ module ATM
|
|
35
35
|
# ATM::Client.new.TestRun.find('DD-R123')
|
36
36
|
#
|
37
37
|
def find(test_run_id)
|
38
|
-
self.class.get("/rest/kanoahtests/1.0/testrun/#{test_run_id}", headers: auth_header).tap do |
|
39
|
-
|
38
|
+
self.class.get("/rest/kanoahtests/1.0/testrun/#{test_run_id}", headers: auth_header).tap do |res|
|
39
|
+
set_response(res)
|
40
40
|
raise ATM::TestRunError, response unless code == 200
|
41
41
|
end
|
42
42
|
end
|
@@ -49,8 +49,8 @@ module ATM
|
|
49
49
|
# ATM::Client.new.TestRun.delete('DD-R123')
|
50
50
|
#
|
51
51
|
def delete(test_run_id)
|
52
|
-
self.class.delete("/rest/kanoahtests/1.0/testrun/#{test_run_id}", headers: auth_header).tap do |
|
53
|
-
|
52
|
+
self.class.delete("/rest/kanoahtests/1.0/testrun/#{test_run_id}", headers: auth_header).tap do |res|
|
53
|
+
set_response(res)
|
54
54
|
raise ATM::TestRunError, response unless code == 204
|
55
55
|
end
|
56
56
|
end
|
@@ -63,15 +63,15 @@ module ATM
|
|
63
63
|
# ATM::Client.new.TestRun.search('projectKey = "JQA"')
|
64
64
|
#
|
65
65
|
def search(query_string)
|
66
|
-
self.class.get("/rest/kanoahtests/1.0/testrun/search?query=#{query_string}", headers: auth_header).tap do |
|
67
|
-
|
66
|
+
self.class.get("/rest/kanoahtests/1.0/testrun/search?query=#{query_string}", headers: auth_header).tap do |res|
|
67
|
+
set_response(res)
|
68
68
|
raise ATM::TestRunError, response unless code == 200
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
# Create new result for a test run
|
73
73
|
#
|
74
|
-
# @param [String]
|
74
|
+
# @param [String] test_run_id
|
75
75
|
# @param [String] test_case_id
|
76
76
|
# @param [Hash] test_data
|
77
77
|
#
|
@@ -88,16 +88,16 @@ module ATM
|
|
88
88
|
# }
|
89
89
|
# ATM::Client.new.TestRun.create_new_test_run_result('DD-R123','DD-T123', test_data)
|
90
90
|
#
|
91
|
-
def create_new_test_run_result(
|
92
|
-
self.class.post("/rest/kanoahtests/1.0/testrun/#{
|
93
|
-
|
94
|
-
raise ATM::TestRunError, response unless code == 201
|
91
|
+
def create_new_test_run_result(test_run_id = @test_run_id, test_case_id, test_data)
|
92
|
+
self.class.post("/rest/kanoahtests/1.0/testrun/#{test_run_id}/testcase/#{test_case_id}/testresult", body: test_data.to_json, headers: auth_header).tap do |res|
|
93
|
+
set_response(res)
|
94
|
+
# raise ATM::TestRunError, response unless code == 201
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
# Update latest result for a test run
|
99
99
|
#
|
100
|
-
# @param [String]
|
100
|
+
# @param [String] test_run_id
|
101
101
|
# @param [String] test_case_id
|
102
102
|
# @param [Hash] test_data
|
103
103
|
#
|
@@ -114,9 +114,9 @@ module ATM
|
|
114
114
|
# }
|
115
115
|
# ATM::Client.new.TestRun.update_last_test_run_result('DD-R123','DD-T123', test_data)
|
116
116
|
#
|
117
|
-
def update_last_test_run_result(
|
118
|
-
self.class.post("/rest/kanoahtests/1.0/testrun/#{
|
119
|
-
|
117
|
+
def update_last_test_run_result(test_run_id = @test_run_id, test_case_id, test_data)
|
118
|
+
self.class.post("/rest/kanoahtests/1.0/testrun/#{test_run_id}/testcase/#{test_case_id}/testresult", body: test_data.to_json, headers: auth_header).tap do |res|
|
119
|
+
set_response(res)
|
120
120
|
end
|
121
121
|
# raise ATM::TestRunError, response unless response.code == 200
|
122
122
|
end
|
data/lib/atm_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atm_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azohra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.6.13
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Adaptavist Test Management API Wrapper
|