tl-api-client 0.1.0
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/testlink/client.rb +229 -0
- data/lib/testlink/client/tl-api-cli.rb +29 -0
- data/lib/testlink/client/version.rb +7 -0
- data/lib/tl-api-client.rb +3 -0
- data/tl-api-client.gemspec +36 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35f3e1f23777fbfbed8b65ccde8d9b44917b0042
|
4
|
+
data.tar.gz: b672a89cdea34c058e6298e23d577938b82775f8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '08a5b786251df496409bb58feab0ec0b9fff2d3f6ae9c50b2b716423963b76ae3e3411829be042bf7176207702fa39b903f0afdf73538eb4d14ae1251ba64db9'
|
7
|
+
data.tar.gz: e50041fdbac747d6962bfe848b4915eae15d8b14793c47fdbe7b297ead7c66f6f40e5ad7aada850c339bcc45cb718d06dc20bcfa1d9f4a90256f3d5b557a7b8f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Emma Chen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Tl::Api::Client
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tl/api/client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'tl-api-client'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tl-api-client
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tl-api-client.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tl/api/client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
require "testlink/client/version"
|
2
|
+
require "xmlrpc/client"
|
3
|
+
|
4
|
+
module Testlink
|
5
|
+
module Client
|
6
|
+
|
7
|
+
def self.new uri, key
|
8
|
+
klass = const_get("TestlinkAPIClient")
|
9
|
+
klass.new uri, key
|
10
|
+
end
|
11
|
+
|
12
|
+
class TestlinkAPIClient
|
13
|
+
attr_accessor :uri, :key
|
14
|
+
|
15
|
+
def initialize uri, key
|
16
|
+
@key = key
|
17
|
+
@uri = get_api_uri uri
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def get_api_uri uri
|
22
|
+
uri + "/lib/api/xmlrpc/v1/xmlrpc.php"
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def get_result method, input = {}
|
27
|
+
connection = XMLRPC::Client.new_from_uri @uri
|
28
|
+
input["devKey"] = @key
|
29
|
+
|
30
|
+
result = connection.call2 method, input
|
31
|
+
if result[0]
|
32
|
+
if result[1][0].class == {}.class and result[1][0].has_key? "message"
|
33
|
+
warn result[1][0]["message"]
|
34
|
+
else
|
35
|
+
result[1]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
raise MethodCallFailed, "Method call to XMLRPC API failed."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def get_latest_build_for_test_plan tplanid
|
44
|
+
|
45
|
+
input = {"testplanid" => tplanid }
|
46
|
+
get_result "tl.getLatestBuildForTestPlan", input
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def get_last_execution_result_by_tcid tplanid, tcid
|
51
|
+
|
52
|
+
input = { "testplanid" => tplanid,
|
53
|
+
"testcaseid" => tcid }
|
54
|
+
get_result "tl.getLastExecutionResult", input
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def get_projects
|
59
|
+
|
60
|
+
get_result "tl.getProjects"
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def get_project_test_plans projectid
|
65
|
+
|
66
|
+
input = { "testprojectid" => projectid }
|
67
|
+
get_result "tl.getProjectTestPlans", input
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def get_test_case_keywords tcid = nil, tcexternalid = nil
|
72
|
+
|
73
|
+
input = { "testcaseid" => tcid,
|
74
|
+
"testcaseexternalid" => tcexternalid }
|
75
|
+
get_result "tl.getTestCaseKeywords", input
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def get_test_case_keywords_by_tcid tcid
|
80
|
+
get_test_case_keywords tcid
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def get_test_case_keywords_by_tcexternalid tcexternalid
|
85
|
+
get_test_case_keywords nil, tcexternalid
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def get_test_project_by_name tprojectname
|
90
|
+
|
91
|
+
input = { "testprojectname" => tprojectname }
|
92
|
+
get_result "tl.getTestProjectByName", input
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
def get_test_plan_by_name tprojectname, tplanname
|
97
|
+
|
98
|
+
input = { "testprojectname" => tprojectname,
|
99
|
+
"testplanname" => tplanname }
|
100
|
+
get_result "tl.getTestPlanByName", input
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def get_test_suites_for_test_plan tplanid
|
105
|
+
|
106
|
+
input = { "testplanid" => tplanid }
|
107
|
+
get_result "tl.getTestSuitesForTestPlan", input
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
def get_test_cases_for_test_plan tplanid, buildid = nil, platformid = nil, testcaseid = nil, keywordid = nil, keywords = nil, executed = nil, assignedto = nil, executestatus = nil, executiontype = nil, getstepinfo = false, details = nil
|
112
|
+
|
113
|
+
input = { "testplanid" => tplanid,
|
114
|
+
"buildid" => buildid,
|
115
|
+
"platformid" => platformid,
|
116
|
+
"testcaseid" => testcaseid,
|
117
|
+
"keywordid" => keywordid,
|
118
|
+
"keywords" => keywords,
|
119
|
+
"executed" => executed,
|
120
|
+
"assignedto" => assignedto,
|
121
|
+
"executestatus" => executestatus,
|
122
|
+
"executiontype" => executiontype,
|
123
|
+
"getstepinfo" => getstepinfo,
|
124
|
+
"details" => details }
|
125
|
+
get_result "tl.getTestCasesForTestPlan", input
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def get_test_suites_for_test_suite tsuiteid
|
130
|
+
|
131
|
+
input = { "testsuiteid" => tsuiteid }
|
132
|
+
get_result "tl.getTestSuitesForTestSuite", input
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
def get_test_case_id_by_name tcasename, tsuitename = nil, tprojectname = nil, tcasepathname = nil
|
137
|
+
|
138
|
+
input = { "testcasename" => tcasename,
|
139
|
+
"testsuitename" => tsuitename,
|
140
|
+
"testprojectname" => tprojectname,
|
141
|
+
"testcasepathanme" => tcasepathname }
|
142
|
+
get_result "tl.getTestCaseIDByName", input
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
def get_first_level_test_suites_for_test_project tprojectid
|
147
|
+
|
148
|
+
input = {"testprojectid" => tprojectid }
|
149
|
+
get_result "tl.getFirstLevelTestSuitesForTestProject", input
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
def get_test_case tcid = nil, tcexternalid = nil
|
154
|
+
|
155
|
+
input = { "testcaseid" => tcid,
|
156
|
+
"testcaseexternalid" => tcexternalid }
|
157
|
+
get_result "tl.getTestCase", input
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
def get_test_case_by_tcid tcid
|
162
|
+
|
163
|
+
get_test_case tcid
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
def get_test_case_by_tcexternalid tcexternalid
|
168
|
+
|
169
|
+
get_test_case nil, tcexternalid
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
def get_test_suite_by_id tsuiteid
|
174
|
+
|
175
|
+
input = { "testsuiteid" => tsuiteid }
|
176
|
+
get_result "tl.getTestSuiteByID", input
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
def get_user_by_id userid
|
181
|
+
|
182
|
+
input = { "userid" => userid }
|
183
|
+
get_result "tl.getUserByID", input
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
def update_test_case tcid, version = nil, testcasename = nil, summary = nil, preconditions = nil, steps = nil, importance = nil, executiontype = nil. status = nil, estimatedexecduration = nil, user = nil
|
188
|
+
|
189
|
+
input = { "testcaseid" => tcid,
|
190
|
+
"version" => version,
|
191
|
+
"testcasename" => testcasename,
|
192
|
+
"summary" => summary,
|
193
|
+
"preconditions" => preconditions,
|
194
|
+
"steps" => steps,
|
195
|
+
"importance" => importance,
|
196
|
+
"executiontype" => executiontype,
|
197
|
+
"status" => status,
|
198
|
+
"estimatedexecduration" => estimatedexecduration,
|
199
|
+
"user" => user }
|
200
|
+
get_result "tl.updateTestCase", input
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
def set_test_case_execution_type tcid, version, tprojectid, executiontype
|
205
|
+
|
206
|
+
input = { "testcaseid" => tcid,
|
207
|
+
"version" => version,
|
208
|
+
"testprojectid" => tprojectid,
|
209
|
+
"executiontype" => executiontype }
|
210
|
+
get_result "tl.setTestCaseExecutionType", input
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
def add_testcase_keywords keywords
|
215
|
+
|
216
|
+
# keywords is a map key: testcaseexternalid, values: array of keyword name
|
217
|
+
input = { "keywords" => keywords }
|
218
|
+
get_result "tl.addTestCaseKeywords", input
|
219
|
+
end
|
220
|
+
|
221
|
+
|
222
|
+
def remove_test_case_keywords keywords
|
223
|
+
|
224
|
+
input = { "keywords" => keywords }
|
225
|
+
get_result "tl.removeTestCaseKeywords", input
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "xmlrpc/client"
|
2
|
+
|
3
|
+
class TestlinkAPIClient
|
4
|
+
|
5
|
+
attr_accessor :url, :key
|
6
|
+
|
7
|
+
def initialize url, key
|
8
|
+
@key = key
|
9
|
+
@url = get_api_url url
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def get_api_url url
|
14
|
+
url + "/lib/api/xmlrpc/v1/xmlrpc.php"
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def get_latest_build_for_test_plan tplanid
|
19
|
+
connection = XMLRPC::Client.new_from_url @url
|
20
|
+
|
21
|
+
input = { "devKey" => @key,"tplanid" => tplanid }
|
22
|
+
result = connection.call2 "getLatestBuildForPlan", input
|
23
|
+
puts result
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'testlink/client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tl-api-client"
|
8
|
+
spec.version = Tl::Api::Client::VERSION
|
9
|
+
spec.authors = ["Emma Chen"]
|
10
|
+
spec.email = ["emmac@synopsys.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby client for Testlink API.}
|
13
|
+
spec.description = %q{Ruby client with an interface to the Testlink XMLRPC client}
|
14
|
+
spec.homepage = "https://gitlab.com/emchen39/testlink-api-cli"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tl-api-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emma Chen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Ruby client with an interface to the Testlink XMLRPC client
|
56
|
+
email:
|
57
|
+
- emmac@synopsys.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/testlink/client.rb
|
72
|
+
- lib/testlink/client/tl-api-cli.rb
|
73
|
+
- lib/testlink/client/version.rb
|
74
|
+
- lib/tl-api-client.rb
|
75
|
+
- tl-api-client.gemspec
|
76
|
+
homepage: https://gitlab.com/emchen39/testlink-api-cli
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata:
|
80
|
+
allowed_push_host: https://rubygems.org
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.6.12
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Ruby client for Testlink API.
|
101
|
+
test_files: []
|