| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TestRail::API; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$TestRail::API::VERSION = '0.009'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
TestRail::API - Provides an interface to TestRail's REST api via HTTP |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use TestRail::API; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $tr = TestRail::API->new($username, $password, $host); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
C provides methods to access an existing TestRail account using API v2. You can then do things like look up tests, set statuses and create runs from lists of cases. |
|
19
|
|
|
|
|
|
|
It is by no means exhaustively implementing every TestRail API function. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
53232
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
77
|
|
|
25
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
47
|
|
|
26
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
153
|
|
|
27
|
2
|
|
|
2
|
|
10
|
use Scalar::Util 'reftype'; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
166
|
|
|
28
|
2
|
|
|
2
|
|
945
|
use Clone 'clone'; |
|
|
2
|
|
|
|
|
4995
|
|
|
|
2
|
|
|
|
|
161
|
|
|
29
|
2
|
|
|
2
|
|
1156
|
use Try::Tiny; |
|
|
2
|
|
|
|
|
2643
|
|
|
|
2
|
|
|
|
|
146
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
|
1510
|
use JSON::XS; |
|
|
2
|
|
|
|
|
12222
|
|
|
|
2
|
|
|
|
|
116
|
|
|
32
|
2
|
|
|
2
|
|
844
|
use HTTP::Request; |
|
|
2
|
|
|
|
|
32120
|
|
|
|
2
|
|
|
|
|
65
|
|
|
33
|
2
|
|
|
2
|
|
1233
|
use LWP::UserAgent; |
|
|
2
|
|
|
|
|
33722
|
|
|
|
2
|
|
|
|
|
76
|
|
|
34
|
2
|
|
|
2
|
|
33
|
use Types::Serialiser; #Not necesarily shared by JSON::XS on all platforms |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
6101
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 B |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Creates new C object. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item STRING C - base url for your TestRail api server. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item STRING C - Your testRail User. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item STRING C - Your TestRail password. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item BOOLEAN C - Print the JSON responses from TL with your requests. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Returns C object if login is successful. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $tr = TestRail::API->new('http://tr.test/testrail', 'moo','M000000!'); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub new { |
|
61
|
0
|
|
|
0
|
1
|
|
my ($class,$apiurl,$user,$pass,$debug) = @_; |
|
62
|
0
|
|
0
|
|
|
|
$user //= $ENV{'TESTRAIL_USER'}; |
|
63
|
0
|
|
0
|
|
|
|
$pass //= $ENV{'TESTRAIL_PASSWORD'}; |
|
64
|
0
|
|
0
|
|
|
|
$debug //= 0; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $self = { |
|
67
|
|
|
|
|
|
|
user => $user, |
|
68
|
|
|
|
|
|
|
pass => $pass, |
|
69
|
|
|
|
|
|
|
apiurl => $apiurl, |
|
70
|
|
|
|
|
|
|
debug => $debug, |
|
71
|
|
|
|
|
|
|
testtree => [], |
|
72
|
|
|
|
|
|
|
flattree => [], |
|
73
|
|
|
|
|
|
|
user_cache => [], |
|
74
|
|
|
|
|
|
|
type_cache => [], |
|
75
|
|
|
|
|
|
|
default_request => undef, |
|
76
|
|
|
|
|
|
|
browser => new LWP::UserAgent() |
|
77
|
|
|
|
|
|
|
}; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#Create default request to pass on to LWP::UserAgent |
|
80
|
0
|
|
|
|
|
|
$self->{'default_request'} = new HTTP::Request(); |
|
81
|
0
|
|
|
|
|
|
$self->{'default_request'}->authorization_basic($user,$pass); |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
bless $self, $class; |
|
84
|
0
|
|
|
|
|
|
return $self; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 GETTERS |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 B |
|
90
|
|
|
|
|
|
|
=head2 B |
|
91
|
|
|
|
|
|
|
=head2 B |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Accessors for these parameters you pass into the constructor, in case you forget. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#EZ access of obj vars |
|
98
|
0
|
|
|
0
|
1
|
|
sub browser {$_[0]->{'browser'}} |
|
99
|
0
|
|
|
0
|
1
|
|
sub apiurl {$_[0]->{'apiurl'}} |
|
100
|
0
|
|
|
0
|
1
|
|
sub debug {$_[0]->{'debug'}} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#Convenient JSON-HTTP fetcher |
|
103
|
|
|
|
|
|
|
sub _doRequest { |
|
104
|
0
|
|
|
0
|
|
|
my ($self,$path,$method,$data) = @_; |
|
105
|
0
|
|
|
|
|
|
my $req = clone $self->{'default_request'}; |
|
106
|
0
|
|
0
|
|
|
|
$method //= 'GET'; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
$req->method($method); |
|
109
|
0
|
|
|
|
|
|
$req->url($self->apiurl.'/'.$path); |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
0
|
|
|
|
|
warn "$method ".$self->apiurl."/$path" if $self->debug; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#Data sent is JSON |
|
114
|
0
|
0
|
|
|
|
|
my $content = $data ? encode_json($data) : ''; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$req->content($content); |
|
117
|
0
|
|
|
|
|
|
$req->header( "Content-Type" => "application/json" ); |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $response = $self->browser->request($req); |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
if ($response->code == 403) { |
|
122
|
0
|
|
|
|
|
|
warn "ERROR: Access Denied."; |
|
123
|
0
|
|
|
|
|
|
return 0; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
0
|
0
|
|
|
|
|
if ($response->code != 200) { |
|
126
|
0
|
|
|
|
|
|
warn "ERROR: Arguments Bad: ".$response->content; |
|
127
|
0
|
|
|
|
|
|
return 0; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
try { |
|
131
|
0
|
|
|
0
|
|
|
return decode_json($response->content); |
|
132
|
|
|
|
|
|
|
} catch { |
|
133
|
0
|
0
|
0
|
0
|
|
|
if ($response->code == 200 && !$response->content) { |
|
134
|
0
|
|
|
|
|
|
return 1; #This function probably just returns no data |
|
135
|
|
|
|
|
|
|
} else { |
|
136
|
0
|
|
|
|
|
|
warn "ERROR: Malformed JSON returned by API."; |
|
137
|
0
|
|
|
|
|
|
warn $@; |
|
138
|
0
|
0
|
|
|
|
|
if (!$self->debug) { #Otherwise we've already printed this, but we need to know if we encounter this |
|
139
|
0
|
|
|
|
|
|
warn "RAW CONTENT:"; |
|
140
|
0
|
|
|
|
|
|
warn $response->content |
|
141
|
|
|
|
|
|
|
} |
|
142
|
0
|
|
|
|
|
|
return 0; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
} |
|
145
|
0
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 USER METHODS |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 B |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Get all the user definitions for the provided Test Rail install. |
|
152
|
|
|
|
|
|
|
Returns ARRAYREF of user definition HASHREFs. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub getUsers { |
|
157
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
158
|
0
|
|
|
|
|
|
$self->{'user_cache'} = $self->_doRequest('index.php?/api/v2/get_users'); |
|
159
|
0
|
|
|
|
|
|
return $self->{'user_cache'}; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 B |
|
163
|
|
|
|
|
|
|
=cut |
|
164
|
|
|
|
|
|
|
=head2 B |
|
165
|
|
|
|
|
|
|
=cut |
|
166
|
|
|
|
|
|
|
=head2 B |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Get user definition hash by ID, Name or Email. |
|
169
|
|
|
|
|
|
|
Returns user def HASHREF. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
#I'm just using the cache for the following methods because it's more straightforward and faster past 1 call. |
|
175
|
|
|
|
|
|
|
sub getUserByID { |
|
176
|
0
|
|
|
0
|
1
|
|
my ($self,$user) = @_; |
|
177
|
0
|
0
|
|
|
|
|
$self->getUsers() if (!scalar(@{$self->{'user_cache'}})); |
|
|
0
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
foreach my $usr (@{$self->{'user_cache'}}) { |
|
|
0
|
|
|
|
|
|
|
|
180
|
0
|
0
|
|
|
|
|
return $usr if $usr->{'id'} == $user; |
|
181
|
|
|
|
|
|
|
} |
|
182
|
0
|
|
|
|
|
|
return 0; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub getUserByName { |
|
186
|
0
|
|
|
0
|
1
|
|
my ($self,$user) = @_; |
|
187
|
0
|
0
|
|
|
|
|
$self->getUsers() if (!scalar(@{$self->{'user_cache'}})); |
|
|
0
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
|
foreach my $usr (@{$self->{'user_cache'}}) { |
|
|
0
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
|
return $usr if $usr->{'name'} eq $user; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
0
|
|
|
|
|
|
return 0; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub getUserByEmail { |
|
195
|
0
|
|
|
0
|
1
|
|
my ($self,$user) = @_; |
|
196
|
0
|
0
|
|
|
|
|
$self->getUsers() if (!scalar(@{$self->{'user_cache'}})); |
|
|
0
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
foreach my $usr (@{$self->{'user_cache'}}) { |
|
|
0
|
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
|
return $usr if $usr->{'email'} eq $user; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
0
|
|
|
|
|
|
return 0; |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 PROJECT METHODS |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 B |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Creates new Project (Database of testsuites/tests). |
|
208
|
|
|
|
|
|
|
Optionally specify an announcement to go out to the users. |
|
209
|
|
|
|
|
|
|
Requires TestRail admin login. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=over 4 |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item STRING C - Desired name of project. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item STRING C (optional) - Description of project. Default value is 'res ipsa loquiter'. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item BOOLEAN C (optional) - Whether to confront users with an announcement about your awesome project on next login. Default false. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=back |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Returns project definition HASHREF on success, false otherwise. |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$tl->createProject('Widgetronic 4000', 'Tests for the whiz-bang new product', true); |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub createProject { |
|
228
|
0
|
|
|
0
|
1
|
|
my ($self,$name,$desc,$announce) = @_; |
|
229
|
0
|
|
0
|
|
|
|
$desc //= 'res ipsa loquiter'; |
|
230
|
0
|
|
0
|
|
|
|
$announce //= 0; |
|
231
|
|
|
|
|
|
|
|
|
232
|
0
|
0
|
|
|
|
|
my $input = { |
|
233
|
|
|
|
|
|
|
name => $name, |
|
234
|
|
|
|
|
|
|
announcement => $desc, |
|
235
|
|
|
|
|
|
|
show_announcement => $announce ? Types::Serialiser::true : Types::Serialiser::false |
|
236
|
|
|
|
|
|
|
}; |
|
237
|
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/add_project','POST',$input); |
|
239
|
0
|
|
|
|
|
|
return $result; |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 B |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Deletes specified project by ID. |
|
246
|
|
|
|
|
|
|
Requires TestRail admin login. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=over 4 |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=item STRING C - Desired name of project. |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=back |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
$success = $tl->deleteProject(1); |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub deleteProject { |
|
261
|
0
|
|
|
0
|
1
|
|
my ($self,$proj) = @_; |
|
262
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/delete_project/'.$proj,'POST'); |
|
263
|
0
|
|
|
|
|
|
return $result; |
|
264
|
|
|
|
|
|
|
} |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head2 B |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Get all available projects |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Returns array of project definition HASHREFs, false otherwise. |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
$projects = $tl->getProjects; |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=cut |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub getProjects { |
|
277
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
278
|
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/get_projects'); |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#Save state for future use, if needed |
|
282
|
0
|
0
|
|
|
|
|
if (!scalar(@{$self->{'testtree'}})) { |
|
|
0
|
|
|
|
|
|
|
|
283
|
0
|
0
|
|
|
|
|
$self->{'testtree'} = $result if $result; |
|
284
|
|
|
|
|
|
|
} |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
0
|
|
|
|
|
if ($result) { |
|
287
|
|
|
|
|
|
|
#Note that it's a project for future reference by recursive tree search |
|
288
|
0
|
|
|
|
|
|
for my $pj (@{$result}) { |
|
|
0
|
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
$pj->{'type'} = 'project'; |
|
290
|
|
|
|
|
|
|
} |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
|
return $result; |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head2 B |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Gets some project definition hash by it's name |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=over 4 |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=item STRING C - desired project |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=back |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
Returns desired project def HASHREF, false otherwise. |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
$projects = $tl->getProjectByName('FunProject'); |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=cut |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
sub getProjectByName { |
|
313
|
0
|
|
|
0
|
1
|
|
my ($self,$project) = @_; |
|
314
|
0
|
0
|
|
|
|
|
confess "No project provided." unless $project; |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
#See if we already have the project list... |
|
317
|
0
|
|
|
|
|
|
my $projects = $self->{'testtree'}; |
|
318
|
0
|
0
|
|
|
|
|
$projects = $self->getProjects() unless scalar(@$projects); |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
#Search project list for project |
|
321
|
0
|
|
|
|
|
|
for my $candidate (@$projects) { |
|
322
|
0
|
0
|
|
|
|
|
return $candidate if ($candidate->{'name'} eq $project); |
|
323
|
|
|
|
|
|
|
} |
|
324
|
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
return 0; |
|
326
|
|
|
|
|
|
|
} |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head2 B |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
Gets some project definition hash by it's ID |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=over 4 |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=item INTEGER C - desired project |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=back |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
Returns desired project def HASHREF, false otherwise. |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
$projects = $tl->getProjectByID(222); |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=cut |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
sub getProjectByID { |
|
345
|
0
|
|
|
0
|
1
|
|
my ($self,$project) = @_; |
|
346
|
0
|
0
|
|
|
|
|
confess "No project provided." unless $project; |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
#See if we already have the project list... |
|
349
|
0
|
|
|
|
|
|
my $projects = $self->{'testtree'}; |
|
350
|
0
|
0
|
|
|
|
|
$projects = $self->getProjects() unless scalar(@$projects); |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
#Search project list for project |
|
353
|
0
|
|
|
|
|
|
for my $candidate (@$projects) { |
|
354
|
0
|
0
|
|
|
|
|
return $candidate if ($candidate->{'id'} eq $project); |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
|
return 0; |
|
358
|
|
|
|
|
|
|
} |
|
359
|
|
|
|
|
|
|
=head1 TESTSUITE METHODS |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=head2 B |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
Creates new TestSuite (folder of tests) in the database of test specifications under given project id having given name and details. |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=over 4 |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item INTEGER C - ID of project this test suite should be under. |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item STRING C - Desired name of test suite. |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=item STRING C (optional) - Description of test suite. Default value is 'res ipsa loquiter'. |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=back |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
Returns TS definition HASHREF on success, false otherwise. |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
$tl->createTestSuite(1, 'broken tests', 'Tests that should be reviewed'); |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=cut |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
sub createTestSuite { |
|
382
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name,$details) = @_; |
|
383
|
0
|
|
0
|
|
|
|
$details ||= 'res ipsa loquiter'; |
|
384
|
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
my $input = { |
|
386
|
|
|
|
|
|
|
name => $name, |
|
387
|
|
|
|
|
|
|
description => $details |
|
388
|
|
|
|
|
|
|
}; |
|
389
|
|
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/add_suite/'.$project_id,'POST',$input); |
|
391
|
0
|
|
|
|
|
|
return $result; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head2 B |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Deletes specified testsuite. |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=over 4 |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=item INTEGER C - ID of testsuite to delete. |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=back |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
$tl->deleteTestSuite(1); |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=cut |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
sub deleteTestSuite { |
|
412
|
0
|
|
|
0
|
1
|
|
my ($self,$suite_id) = @_; |
|
413
|
|
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/delete_suite/'.$suite_id,'POST'); |
|
415
|
0
|
|
|
|
|
|
return $result; |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
} |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
=head2 B |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
Gets the testsuites for a project |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=over 4 |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=item STRING C - desired project's ID |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=back |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Returns ARRAYREF of testsuite definition HASHREFs, 0 on error. |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
$suites = $tl->getTestSuites(123); |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=cut |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
sub getTestSuites { |
|
436
|
0
|
|
|
0
|
1
|
|
my ($self,$proj) = @_; |
|
437
|
0
|
|
|
|
|
|
return $self->_doRequest('index.php?/api/v2/get_suites/'.$proj); |
|
438
|
|
|
|
|
|
|
} |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=head2 B |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
Gets the testsuite that matches the given name inside of given project. |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=over 4 |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
=item STRING C - ID of project holding this testsuite |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=item STRING C - desired parent testsuite name |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=back |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
Returns desired testsuite definition HASHREF, false otherwise. |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
$suites = $tl->getTestSuitesByName(321, 'hugSuite'); |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=cut |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub getTestSuiteByName { |
|
459
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$testsuite_name) = @_; |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
#TODO cache |
|
462
|
0
|
|
|
|
|
|
my $suites = $self->getTestSuites($project_id); |
|
463
|
0
|
0
|
|
|
|
|
return 0 if !$suites; #No suites for project, or no project |
|
464
|
|
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
|
foreach my $suite (@$suites) { |
|
466
|
0
|
0
|
|
|
|
|
return $suite if $suite->{'name'} eq $testsuite_name; |
|
467
|
|
|
|
|
|
|
} |
|
468
|
0
|
|
|
|
|
|
return 0; #Couldn't find it |
|
469
|
|
|
|
|
|
|
} |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=head2 B |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Gets the testsuite with the given ID. |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=over 4 |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=item STRING C - Testsuite ID. |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=back |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
Returns desired testsuite definition HASHREF, false otherwise. |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
$tests = $tl->getTestSuiteByID(123); |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=cut |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
sub getTestSuiteByID { |
|
488
|
0
|
|
|
0
|
1
|
|
my ($self,$testsuite_id) = @_; |
|
489
|
|
|
|
|
|
|
|
|
490
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/get_suite/'.$testsuite_id); |
|
491
|
0
|
|
|
|
|
|
return $result; |
|
492
|
|
|
|
|
|
|
} |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=head1 SECTION METHODS |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=head2 B |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
Creates a section. |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=over 4 |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=item INTEGER C - Parent Project ID. |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=item INTEGER C - Parent Testsuite ID. |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=item STRING C - desired section name. |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=item INTEGER C (optional) - parent section id |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
=back |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
Returns new section definition HASHREF, false otherwise. |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
$section = $tr->createSection(1,1,'nugs',1); |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=cut |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub createSection { |
|
519
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id,$name,$parent_id) = @_; |
|
520
|
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
my $input = { |
|
522
|
|
|
|
|
|
|
name => $name, |
|
523
|
|
|
|
|
|
|
suite_id => $suite_id |
|
524
|
|
|
|
|
|
|
}; |
|
525
|
0
|
0
|
|
|
|
|
$input->{'parent_id'} = $parent_id if $parent_id; |
|
526
|
|
|
|
|
|
|
|
|
527
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/add_section/'.$project_id,'POST',$input); |
|
528
|
0
|
|
|
|
|
|
return $result; |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
} |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=head2 B |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Deletes specified section. |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=over 4 |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=item INTEGER C - ID of section to delete. |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=back |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
$tr->deleteSection(1); |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=cut |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
sub deleteSection { |
|
549
|
0
|
|
|
0
|
1
|
|
my ($self,$section_id) = @_; |
|
550
|
|
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
|
my $result = $self->_doRequest('index.php?/api/v2/delete_section/'.$section_id,'POST'); |
|
552
|
0
|
|
|
|
|
|
return $result; |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
} |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=head2 B |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
Gets sections for a given project and suite. |
|
559
|
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
=over 4 |
|
561
|
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
=item INTEGER C - ID of suite to get sections for. |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=back |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
Returns ARRAYREF of section definition HASHREFs. |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
$tr->getSections(1,2); |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=cut |
|
573
|
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub getSections { |
|
575
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id) = @_; |
|
576
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_sections/$project_id&suite_id=$suite_id"); |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
=head2 B |
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
Gets desired section. |
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=over 4 |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
=item INTEGER C - ID of suite to get sections for. |
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=back |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
Returns section definition HASHREF. |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
$tr->getSectionByID(344); |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=cut |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
sub getSectionByID { |
|
598
|
0
|
|
|
0
|
1
|
|
my ($self,$section_id) = @_; |
|
599
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_section/$section_id"); |
|
600
|
|
|
|
|
|
|
} |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=head2 B |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
Gets desired section. |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=over 4 |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=item INTEGER C - ID of suite to get section for. |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=item STRING C - name of section to get |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=back |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
Returns section definition HASHREF. |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
$tr->getSectionByName(1,2,'nugs'); |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=cut |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
sub getSectionByName { |
|
623
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id,$section_name) = @_; |
|
624
|
0
|
|
|
|
|
|
my $sections = $self->getSections($project_id,$suite_id); |
|
625
|
0
|
|
|
|
|
|
foreach my $sec (@$sections) { |
|
626
|
0
|
0
|
|
|
|
|
return $sec if $sec->{'name'} eq $section_name; |
|
627
|
|
|
|
|
|
|
} |
|
628
|
0
|
|
|
|
|
|
return 0; |
|
629
|
|
|
|
|
|
|
} |
|
630
|
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=head1 CASE METHODS |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=head2 B |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
Gets possible case types. |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
Returns ARRAYREF of case type definition HASHREFs. |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
$tr->getCaseTypes(); |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=cut |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
sub getCaseTypes { |
|
644
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
645
|
0
|
0
|
|
|
|
|
$self->{'type_cache'} = $self->_doRequest("index.php?/api/v2/get_case_types") if !$self->type_cache; #We can't change this with API, so assume it is static |
|
646
|
0
|
|
|
|
|
|
return $self->{'type_cache'}; |
|
647
|
|
|
|
|
|
|
} |
|
648
|
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=head2 B |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
Gets case type by name. |
|
652
|
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=over 4 |
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
=item STRING C - Name of desired case type |
|
656
|
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
=back |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
Returns case type definition HASHREF. |
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
$tr->getCaseTypeByName(); |
|
662
|
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=cut |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
sub getCaseTypeByName { |
|
666
|
|
|
|
|
|
|
#Useful for marking automated tests, etc |
|
667
|
0
|
|
|
0
|
1
|
|
my ($self,$name) = @_; |
|
668
|
0
|
|
|
|
|
|
my $types = $self->getCaseTypes(); |
|
669
|
0
|
|
|
|
|
|
foreach my $type (@$types) { |
|
670
|
0
|
0
|
|
|
|
|
return $type if $type->{'name'} eq $name; |
|
671
|
|
|
|
|
|
|
} |
|
672
|
0
|
|
|
|
|
|
return 0; |
|
673
|
|
|
|
|
|
|
} |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=head2 B |
|
676
|
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
Creates a test case. |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=over 4 |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=item INTEGER C |
|
682
|
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=item STRING C - Case title. |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
=item INTEGER C - desired test type's ID. |
|
686
|
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=item HASHREF C (optional) - Custom fields in the case are the keys, set to the values provided. See TestRail API documentation for more info. |
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
=item HASHREF C (optional) - contains priority_id, estimate, milestone_id and refs as possible keys. See TestRail API documentation for more info. |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=back |
|
692
|
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
Returns new case definition HASHREF, false otherwise. |
|
694
|
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
$custom_opts = { |
|
696
|
|
|
|
|
|
|
preconds => "Test harness installed", |
|
697
|
|
|
|
|
|
|
steps => "Do the needful", |
|
698
|
|
|
|
|
|
|
expected => "cubicle environment transforms into Dali painting" |
|
699
|
|
|
|
|
|
|
}; |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
$other_opts = { |
|
702
|
|
|
|
|
|
|
priority_id => 4, |
|
703
|
|
|
|
|
|
|
milestone_id => 666, |
|
704
|
|
|
|
|
|
|
estimate => '2m 45s', |
|
705
|
|
|
|
|
|
|
refs => ['TRACE-22','ON-166'] #ARRAYREF of bug IDs. |
|
706
|
|
|
|
|
|
|
} |
|
707
|
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
$case = $tr->createCase(1,'Do some stuff',3,$custom_opts,$other_opts); |
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=cut |
|
711
|
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
sub createCase { |
|
713
|
0
|
|
|
0
|
1
|
|
my ($self,$section_id,$title,$type_id,$opts,$extras) = @_; |
|
714
|
|
|
|
|
|
|
|
|
715
|
0
|
|
|
|
|
|
my $stuff = { |
|
716
|
|
|
|
|
|
|
title => $title, |
|
717
|
|
|
|
|
|
|
type_id => $type_id |
|
718
|
|
|
|
|
|
|
}; |
|
719
|
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
#Handle sort of optional but baked in options |
|
721
|
0
|
0
|
0
|
|
|
|
if (defined($extras) && reftype($extras) eq 'HASH') { |
|
722
|
0
|
0
|
|
|
|
|
$stuff->{'priority_id'} = $extras->{'priority_id'} if defined($extras->{'priority_id'}); |
|
723
|
0
|
0
|
|
|
|
|
$stuff->{'estimate'} = $extras->{'estimate'} if defined($extras->{'estimate'}); |
|
724
|
0
|
0
|
|
|
|
|
$stuff->{'milestone_id'} = $extras->{'milestone_id'} if defined($extras->{'milestone_id'}); |
|
725
|
0
|
0
|
|
|
|
|
$stuff->{'refs'} = join(',',@{$extras->{'refs'}}) if defined($extras->{'refs'}); |
|
|
0
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
} |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
#Handle custom fields |
|
729
|
0
|
0
|
0
|
|
|
|
if (defined($opts) && reftype($opts) eq 'HASH') { |
|
730
|
0
|
|
|
|
|
|
foreach my $key (keys(%$opts)) { |
|
731
|
0
|
|
|
|
|
|
$stuff->{"custom_$key"} = $opts->{$key}; |
|
732
|
|
|
|
|
|
|
} |
|
733
|
|
|
|
|
|
|
} |
|
734
|
|
|
|
|
|
|
|
|
735
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/add_case/$section_id",'POST',$stuff); |
|
736
|
0
|
|
|
|
|
|
return $result; |
|
737
|
|
|
|
|
|
|
} |
|
738
|
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
=head2 B |
|
740
|
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
Deletes specified section. |
|
742
|
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
=over 4 |
|
744
|
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=item INTEGER C - ID of case to delete. |
|
746
|
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
=back |
|
748
|
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
750
|
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
$tr->deleteCase(1324); |
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
=cut |
|
754
|
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
sub deleteCase { |
|
756
|
0
|
|
|
0
|
1
|
|
my ($self,$case_id) = @_; |
|
757
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/delete_case/$case_id",'POST'); |
|
758
|
0
|
|
|
|
|
|
return $result; |
|
759
|
|
|
|
|
|
|
} |
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
=head2 B |
|
762
|
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
Gets cases for provided section. |
|
764
|
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
=over 4 |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
768
|
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
=item INTEGER C - ID of parent suite. |
|
770
|
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
=item INTEGER C |
|
772
|
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
=back |
|
774
|
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
Returns ARRAYREF of test case definition HASHREFs. |
|
776
|
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
$tr->getCases(1,2,3); |
|
778
|
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
=cut |
|
780
|
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
sub getCases { |
|
782
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id,$section_id) = @_; |
|
783
|
0
|
|
|
|
|
|
my $url = "index.php?/api/v2/get_cases/$project_id&suite_id=$suite_id"; |
|
784
|
0
|
0
|
|
|
|
|
$url .= "§ion_id=$section_id" if $section_id; |
|
785
|
0
|
|
|
|
|
|
return $self->_doRequest($url); |
|
786
|
|
|
|
|
|
|
} |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=head2 B |
|
789
|
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
Gets case by name. |
|
791
|
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=over 4 |
|
793
|
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=item INTEGER C - ID of parent suite. |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=item INTEGER C |
|
799
|
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=item STRING - Name of desired test case. |
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=back |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
Returns test case definition HASHREF. |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
$tr->getCaseByName(1,2,3,'nugs'); |
|
807
|
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=cut |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
sub getCaseByName { |
|
811
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id,$section_id,$name) = @_; |
|
812
|
0
|
|
|
|
|
|
my $cases = $self->getCases($project_id,$suite_id,$section_id); |
|
813
|
0
|
|
|
|
|
|
foreach my $case (@$cases) { |
|
814
|
0
|
0
|
|
|
|
|
return $case if $case->{'title'} eq $name; |
|
815
|
|
|
|
|
|
|
} |
|
816
|
0
|
|
|
|
|
|
return 0; |
|
817
|
|
|
|
|
|
|
} |
|
818
|
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
=head2 B |
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
Gets case by ID. |
|
822
|
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
=over 4 |
|
824
|
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
=item INTEGER C - ID of case. |
|
826
|
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
=back |
|
828
|
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
Returns test case definition HASHREF. |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
$tr->getCaseByID(1345); |
|
832
|
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=cut |
|
834
|
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
sub getCaseByID { |
|
836
|
0
|
|
|
0
|
1
|
|
my ($self,$case_id) = @_; |
|
837
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_case/$case_id"); |
|
838
|
|
|
|
|
|
|
} |
|
839
|
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
=head1 RUN METHODS |
|
841
|
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
=head2 B |
|
843
|
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
Create a run. |
|
845
|
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
=over 4 |
|
847
|
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
849
|
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
=item INTEGER C - ID of suite to base run on |
|
851
|
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
=item STRING C - Name of run |
|
853
|
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=item STRING C (optional) - Description of run |
|
855
|
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=item INTEGER C (optional) - ID of milestone |
|
857
|
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
=item INTEGER C (optional) - User to assign the run to |
|
859
|
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
=item ARRAYREF C (optional) - Array of case IDs in case you don't want to use the whole testsuite when making the build. |
|
861
|
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=back |
|
863
|
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
Returns run definition HASHREF. |
|
865
|
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
$tr->createRun(1,1345,'RUN AWAY','SO FAR AWAY',22,3,[3,4,5,6]); |
|
867
|
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=cut |
|
869
|
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
#If you pass an array of case ids, it implies include_all is false |
|
871
|
|
|
|
|
|
|
sub createRun { |
|
872
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$suite_id,$name,$desc,$milestone_id,$assignedto_id,$case_ids) = @_; |
|
873
|
|
|
|
|
|
|
|
|
874
|
0
|
0
|
|
|
|
|
my $stuff = { |
|
875
|
|
|
|
|
|
|
suite_id => $suite_id, |
|
876
|
|
|
|
|
|
|
name => $name, |
|
877
|
|
|
|
|
|
|
description => $desc, |
|
878
|
|
|
|
|
|
|
milestone_id => $milestone_id, |
|
879
|
|
|
|
|
|
|
assignedto_id => $assignedto_id, |
|
880
|
|
|
|
|
|
|
include_all => $case_ids ? Types::Serialiser::false : Types::Serialiser::true, |
|
881
|
|
|
|
|
|
|
case_ids => $case_ids |
|
882
|
|
|
|
|
|
|
}; |
|
883
|
|
|
|
|
|
|
|
|
884
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/add_run/$project_id",'POST',$stuff); |
|
885
|
0
|
|
|
|
|
|
return $result; |
|
886
|
|
|
|
|
|
|
} |
|
887
|
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=head2 B |
|
889
|
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
Deletes specified run. |
|
891
|
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
=over 4 |
|
893
|
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
=item INTEGER C - ID of run to delete. |
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
=back |
|
897
|
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
899
|
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
$tr->deleteRun(1324); |
|
901
|
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
=cut |
|
903
|
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
sub deleteRun { |
|
905
|
0
|
|
|
0
|
1
|
|
my ($self,$suite_id) = @_; |
|
906
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/delete_run/$suite_id",'POST'); |
|
907
|
0
|
|
|
|
|
|
return $result; |
|
908
|
|
|
|
|
|
|
} |
|
909
|
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
=head2 B |
|
911
|
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
Get all runs for specified project. |
|
913
|
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
=over 4 |
|
915
|
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project |
|
917
|
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
=back |
|
919
|
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
Returns ARRAYREF of run definition HASHREFs. |
|
921
|
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
$allRuns = $tr->getRuns(6969); |
|
923
|
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=cut |
|
925
|
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
sub getRuns { |
|
927
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id) = @_; |
|
928
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_runs/$project_id"); |
|
929
|
|
|
|
|
|
|
} |
|
930
|
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
=head2 B |
|
933
|
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
Gets run by name. |
|
935
|
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
=over 4 |
|
937
|
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
939
|
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
=item STRING - Name of desired run. |
|
941
|
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
=back |
|
943
|
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
Returns run definition HASHREF. |
|
945
|
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
$tr->getRunByName(1,'gravy'); |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=cut |
|
949
|
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
sub getRunByName { |
|
951
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name) = @_; |
|
952
|
0
|
|
|
|
|
|
my $runs = $self->getRuns($project_id); |
|
953
|
0
|
|
|
|
|
|
foreach my $run (@$runs) { |
|
954
|
0
|
0
|
|
|
|
|
return $run if $run->{'name'} eq $name; |
|
955
|
|
|
|
|
|
|
} |
|
956
|
0
|
|
|
|
|
|
return 0; |
|
957
|
|
|
|
|
|
|
} |
|
958
|
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=head2 B |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
Gets run by ID. |
|
962
|
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
=over 4 |
|
964
|
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
=item INTEGER C - ID of desired run. |
|
966
|
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
=back |
|
968
|
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
Returns run definition HASHREF. |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
$tr->getRunByID(7779311); |
|
972
|
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
=cut |
|
974
|
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
sub getRunByID { |
|
976
|
0
|
|
|
0
|
1
|
|
my ($self,$run_id) = @_; |
|
977
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_run/$run_id"); |
|
978
|
|
|
|
|
|
|
} |
|
979
|
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
=head1 PLAN METHODS |
|
981
|
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
=head2 B |
|
983
|
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
Create a run. |
|
985
|
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
=over 4 |
|
987
|
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
989
|
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
=item STRING C - Name of plan |
|
991
|
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
=item STRING C (optional) - Description of plan |
|
993
|
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=item INTEGER C (optional) - ID of milestone |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=item ARRAYREF C (optional) - New Runs to initially populate the plan with -- See TestLink API documentation for more advanced inputs here. |
|
997
|
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=back |
|
999
|
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
Returns test plan definition HASHREF, or false on failure. |
|
1001
|
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
$entries = { |
|
1003
|
|
|
|
|
|
|
suite_id => 345, |
|
1004
|
|
|
|
|
|
|
include_all => Types::Serialiser::true, |
|
1005
|
|
|
|
|
|
|
assignedto_id => 1 |
|
1006
|
|
|
|
|
|
|
} |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
$tr->createPlan(1,'Gosplan','Robo-Signed Soviet 5-year plan',22,$entries); |
|
1009
|
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=cut |
|
1011
|
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
sub createPlan { |
|
1013
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name,$desc,$milestone_id,$entries) = @_; |
|
1014
|
|
|
|
|
|
|
|
|
1015
|
0
|
|
|
|
|
|
my $stuff = { |
|
1016
|
|
|
|
|
|
|
name => $name, |
|
1017
|
|
|
|
|
|
|
description => $desc, |
|
1018
|
|
|
|
|
|
|
milestone_id => $milestone_id, |
|
1019
|
|
|
|
|
|
|
entries => $entries |
|
1020
|
|
|
|
|
|
|
}; |
|
1021
|
|
|
|
|
|
|
|
|
1022
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/add_plan/$project_id",'POST',$stuff); |
|
1023
|
0
|
|
|
|
|
|
return $result; |
|
1024
|
|
|
|
|
|
|
} |
|
1025
|
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=head2 B |
|
1027
|
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
Deletes specified plan. |
|
1029
|
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
=over 4 |
|
1031
|
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
=item INTEGER C - ID of plan to delete. |
|
1033
|
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
=back |
|
1035
|
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
1037
|
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
$tr->deletePlan(8675309); |
|
1039
|
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
=cut |
|
1041
|
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
sub deletePlan { |
|
1043
|
0
|
|
|
0
|
1
|
|
my ($self,$plan_id) = @_; |
|
1044
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/delete_plan/$plan_id",'POST'); |
|
1045
|
0
|
|
|
|
|
|
return $result; |
|
1046
|
|
|
|
|
|
|
} |
|
1047
|
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
=head2 B |
|
1049
|
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
Deletes specified plan. |
|
1051
|
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
=over 4 |
|
1053
|
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
1055
|
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
=back |
|
1057
|
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
Returns ARRAYREF of plan definition HASHREFs. |
|
1059
|
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
$tr->getPlans(8); |
|
1061
|
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
=cut |
|
1063
|
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
sub getPlans { |
|
1065
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id) = @_; |
|
1066
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_plans/$project_id"); |
|
1067
|
|
|
|
|
|
|
} |
|
1068
|
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
=head2 B |
|
1070
|
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
Gets specified plan by name. |
|
1072
|
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
=over 4 |
|
1074
|
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
1076
|
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
=item STRING C - Name of test plan. |
|
1078
|
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
=back |
|
1080
|
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
Returns plan definition HASHREF. |
|
1082
|
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
$tr->getPlanByName(8,'GosPlan'); |
|
1084
|
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=cut |
|
1086
|
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
sub getPlanByName { |
|
1088
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name) = @_; |
|
1089
|
0
|
|
|
|
|
|
my $plans = $self->getPlans($project_id); |
|
1090
|
0
|
|
|
|
|
|
foreach my $plan (@$plans) { |
|
1091
|
0
|
0
|
|
|
|
|
return $plan if $plan->{'name'} eq $name; |
|
1092
|
|
|
|
|
|
|
} |
|
1093
|
0
|
|
|
|
|
|
return 0; |
|
1094
|
|
|
|
|
|
|
} |
|
1095
|
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=head2 B |
|
1097
|
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
Gets specified plan by ID. |
|
1099
|
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
=over 4 |
|
1101
|
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=item INTEGER C - ID of plan. |
|
1103
|
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
=back |
|
1105
|
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
Returns plan definition HASHREF. |
|
1107
|
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
$tr->getPlanByID(2); |
|
1109
|
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
=cut |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
sub getPlanByID { |
|
1113
|
0
|
|
|
0
|
1
|
|
my ($self,$plan_id) = @_; |
|
1114
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_plan/$plan_id"); |
|
1115
|
|
|
|
|
|
|
} |
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
=head1 MILESTONE METHODS |
|
1118
|
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
=head2 B |
|
1120
|
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
Create a milestone. |
|
1122
|
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
=over 4 |
|
1124
|
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
=item STRING C - Name of milestone |
|
1128
|
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
=item STRING C (optional) - Description of milestone |
|
1130
|
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
=item INTEGER C - Date at which milestone should be completed. Unix Timestamp. |
|
1132
|
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
=back |
|
1134
|
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
Returns milestone definition HASHREF, or false on failure. |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
$tr->createMilestone(1,'Patriotic victory of world perlism','Accomplish by Robo-Signed Soviet 5-year plan',time()+157788000); |
|
1138
|
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
=cut |
|
1140
|
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
sub createMilestone { |
|
1142
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name,$desc,$due_on) = @_; |
|
1143
|
|
|
|
|
|
|
|
|
1144
|
0
|
|
|
|
|
|
my $stuff = { |
|
1145
|
|
|
|
|
|
|
name => $name, |
|
1146
|
|
|
|
|
|
|
description => $desc, |
|
1147
|
|
|
|
|
|
|
due_on => $due_on # unix timestamp |
|
1148
|
|
|
|
|
|
|
}; |
|
1149
|
|
|
|
|
|
|
|
|
1150
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/add_milestone/$project_id",'POST',$stuff); |
|
1151
|
0
|
|
|
|
|
|
return $result; |
|
1152
|
|
|
|
|
|
|
} |
|
1153
|
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
=head2 B |
|
1155
|
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
Deletes specified milestone. |
|
1157
|
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
=over 4 |
|
1159
|
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
=item INTEGER C - ID of milestone to delete. |
|
1161
|
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
=back |
|
1163
|
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
Returns BOOLEAN. |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
$tr->deleteMilestone(86); |
|
1167
|
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
=cut |
|
1169
|
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
sub deleteMilestone { |
|
1171
|
0
|
|
|
0
|
1
|
|
my ($self,$milestone_id) = @_; |
|
1172
|
0
|
|
|
|
|
|
my $result = $self->_doRequest("index.php?/api/v2/delete_milestone/$milestone_id",'POST'); |
|
1173
|
0
|
|
|
|
|
|
return $result; |
|
1174
|
|
|
|
|
|
|
} |
|
1175
|
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=head2 B |
|
1177
|
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
Get milestones for some project. |
|
1179
|
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=over 4 |
|
1181
|
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
1183
|
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
=back |
|
1185
|
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
Returns ARRAYREF of milestone definition HASHREFs. |
|
1187
|
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
$tr->getMilestones(8); |
|
1189
|
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
=cut |
|
1191
|
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
sub getMilestones { |
|
1193
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id) = @_; |
|
1194
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_milestones/$project_id"); |
|
1195
|
|
|
|
|
|
|
} |
|
1196
|
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
=head2 B |
|
1198
|
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
Gets specified milestone by name. |
|
1200
|
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
=over 4 |
|
1202
|
|
|
|
|
|
|
|
|
1203
|
|
|
|
|
|
|
=item INTEGER C - ID of parent project. |
|
1204
|
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
=item STRING C - Name of milestone. |
|
1206
|
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
=back |
|
1208
|
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
Returns milestone definition HASHREF. |
|
1210
|
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
$tr->getMilestoneByName(8,'whee'); |
|
1212
|
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
=cut |
|
1214
|
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
sub getMilestoneByName { |
|
1216
|
0
|
|
|
0
|
1
|
|
my ($self,$project_id,$name) = @_; |
|
1217
|
0
|
|
|
|
|
|
my $milestones = $self->getMilestones($project_id); |
|
1218
|
0
|
|
|
|
|
|
foreach my $milestone (@$milestones) { |
|
1219
|
0
|
0
|
|
|
|
|
return $milestone if $milestone->{'name'} eq $name; |
|
1220
|
|
|
|
|
|
|
} |
|
1221
|
0
|
|
|
|
|
|
return 0; |
|
1222
|
|
|
|
|
|
|
} |
|
1223
|
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
=head2 B |
|
1225
|
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
Gets specified milestone by ID. |
|
1227
|
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
=over 4 |
|
1229
|
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
=item INTEGER C - ID of milestone. |
|
1231
|
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
=back |
|
1233
|
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
Returns milestione definition HASHREF. |
|
1235
|
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
$tr->getMilestoneByID(2); |
|
1237
|
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
=cut |
|
1239
|
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
sub getMilestoneByID { |
|
1241
|
0
|
|
|
0
|
1
|
|
my ($self,$milestone_id) = @_; |
|
1242
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_milestone/$milestone_id"); |
|
1243
|
|
|
|
|
|
|
} |
|
1244
|
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
=head1 TEST METHODS |
|
1246
|
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
=head2 B |
|
1248
|
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
Get tests for some run. |
|
1250
|
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
=over 4 |
|
1252
|
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
=item INTEGER C - ID of parent run. |
|
1254
|
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
=back |
|
1256
|
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
Returns ARRAYREF of test definition HASHREFs. |
|
1258
|
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
$tr->getTests(8); |
|
1260
|
|
|
|
|
|
|
|
|
1261
|
|
|
|
|
|
|
=cut |
|
1262
|
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
sub getTests { |
|
1264
|
0
|
|
|
0
|
1
|
|
my ($self,$run_id) = @_; |
|
1265
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_tests/$run_id"); |
|
1266
|
|
|
|
|
|
|
} |
|
1267
|
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
=head2 B |
|
1269
|
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
Gets specified test by name. |
|
1271
|
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
=over 4 |
|
1273
|
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
=item INTEGER C - ID of parent run. |
|
1275
|
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
=item STRING C - Name of milestone. |
|
1277
|
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
=back |
|
1279
|
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
Returns test definition HASHREF. |
|
1281
|
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
$tr->getTestByName(36,'wheeTest'); |
|
1283
|
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
=cut |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
sub getTestByName { |
|
1287
|
0
|
|
|
0
|
1
|
|
my ($self,$run_id,$name) = @_; |
|
1288
|
0
|
|
|
|
|
|
my $tests = $self->getTests($run_id); |
|
1289
|
0
|
|
|
|
|
|
foreach my $test (@$tests) { |
|
1290
|
0
|
0
|
|
|
|
|
return $test if $test->{'title'} eq $name; |
|
1291
|
|
|
|
|
|
|
} |
|
1292
|
0
|
|
|
|
|
|
return 0; |
|
1293
|
|
|
|
|
|
|
} |
|
1294
|
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
=head2 B |
|
1296
|
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
Gets specified test by ID. |
|
1298
|
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
=over 4 |
|
1300
|
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
=item INTEGER C - ID of test. |
|
1302
|
|
|
|
|
|
|
|
|
1303
|
|
|
|
|
|
|
=back |
|
1304
|
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
Returns test definition HASHREF. |
|
1306
|
|
|
|
|
|
|
|
|
1307
|
|
|
|
|
|
|
$tr->getTestByID(222222); |
|
1308
|
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
=cut |
|
1310
|
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
sub getTestByID { |
|
1312
|
0
|
|
|
0
|
1
|
|
my ($self,$test_id) = @_; |
|
1313
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/get_test/$test_id"); |
|
1314
|
|
|
|
|
|
|
} |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=head2 B |
|
1317
|
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
Gets custom fields that can be set for tests. |
|
1319
|
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
Returns ARRAYREF of result definition HASHREFs. |
|
1321
|
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
=cut |
|
1323
|
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
sub getTestResultFields { |
|
1325
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1326
|
0
|
|
|
|
|
|
return $self->_doRequest('index.php?/api/v2/get_result_fields'); |
|
1327
|
|
|
|
|
|
|
} |
|
1328
|
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
=head2 B |
|
1330
|
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
Gets all possible statuses a test can be set to. |
|
1332
|
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
Returns ARRAYREF of status definition HASHREFs. |
|
1334
|
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
=cut |
|
1336
|
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
sub getPossibleTestStatuses { |
|
1338
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1339
|
0
|
|
|
|
|
|
return $self->_doRequest('index.php?/api/v2/get_statuses'); |
|
1340
|
|
|
|
|
|
|
} |
|
1341
|
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
=head2 B |
|
1343
|
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
Creates a result entry for a test. |
|
1345
|
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
Returns result definition HASHREF. |
|
1347
|
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
$options = { |
|
1349
|
|
|
|
|
|
|
elapsed => '30m 22s', |
|
1350
|
|
|
|
|
|
|
defects => ['TSR-3','BOOM-44'], |
|
1351
|
|
|
|
|
|
|
version => '6969' |
|
1352
|
|
|
|
|
|
|
}; |
|
1353
|
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
$custom_options = { |
|
1355
|
|
|
|
|
|
|
step_results => [ |
|
1356
|
|
|
|
|
|
|
{ |
|
1357
|
|
|
|
|
|
|
content => 'Step 1', |
|
1358
|
|
|
|
|
|
|
expected => "Bought Groceries", |
|
1359
|
|
|
|
|
|
|
actual => "No Dinero!", |
|
1360
|
|
|
|
|
|
|
status_id => 2 |
|
1361
|
|
|
|
|
|
|
}, |
|
1362
|
|
|
|
|
|
|
{ |
|
1363
|
|
|
|
|
|
|
content => 'Step 2', |
|
1364
|
|
|
|
|
|
|
expected => 'Ate Dinner', |
|
1365
|
|
|
|
|
|
|
actual => 'Went Hungry', |
|
1366
|
|
|
|
|
|
|
status_id => 2 |
|
1367
|
|
|
|
|
|
|
} |
|
1368
|
|
|
|
|
|
|
] |
|
1369
|
|
|
|
|
|
|
}; |
|
1370
|
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
$res = $tr->createTestResults(1,2,'Test failed because it was all like WAAAAAAA when I poked it',$options,$custom_options); |
|
1372
|
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
=cut |
|
1374
|
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
sub createTestResults { |
|
1376
|
0
|
|
|
0
|
1
|
|
my ($self,$test_id,$status_id,$comment,$opts,$custom_fields) = @_; |
|
1377
|
0
|
|
|
|
|
|
my $stuff = { |
|
1378
|
|
|
|
|
|
|
status_id => $status_id, |
|
1379
|
|
|
|
|
|
|
comment => $comment |
|
1380
|
|
|
|
|
|
|
}; |
|
1381
|
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
#Handle options |
|
1383
|
0
|
0
|
0
|
|
|
|
if (defined($opts) && reftype($opts) eq 'HASH') { |
|
1384
|
0
|
0
|
|
|
|
|
$stuff->{'version'} = defined($opts->{'version'}) ? $opts->{'version'} : undef; |
|
1385
|
0
|
0
|
|
|
|
|
$stuff->{'elapsed'} = defined($opts->{'elapsed'}) ? $opts->{'elapsed'} : undef; |
|
1386
|
0
|
0
|
|
|
|
|
$stuff->{'defects'} = defined($opts->{'defects'}) ? join(',',@{$opts->{'defects'}}) : undef; |
|
|
0
|
|
|
|
|
|
|
|
1387
|
0
|
0
|
|
|
|
|
$stuff->{'assignedto_id'} = defined($opts->{'assignedto_id'}) ? $opts->{'assignedto_id'} : undef; |
|
1388
|
|
|
|
|
|
|
} |
|
1389
|
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
#Handle custom fields |
|
1391
|
0
|
0
|
0
|
|
|
|
if (defined($custom_fields) && reftype($custom_fields) eq 'HASH') { |
|
1392
|
0
|
|
|
|
|
|
foreach my $field (keys(%$custom_fields)) { |
|
1393
|
0
|
|
|
|
|
|
$stuff->{"custom_$field"} = $custom_fields->{$field}; |
|
1394
|
|
|
|
|
|
|
} |
|
1395
|
|
|
|
|
|
|
} |
|
1396
|
|
|
|
|
|
|
|
|
1397
|
0
|
|
|
|
|
|
return $self->_doRequest("index.php?/api/v2/add_result/$test_id",'POST',$stuff); |
|
1398
|
|
|
|
|
|
|
} |
|
1399
|
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
=head2 B |
|
1401
|
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
Get the recorded results for desired test, limiting output to 'limit' entries. |
|
1403
|
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
=over 4 |
|
1405
|
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
=item INTEGER C - ID of desired test |
|
1407
|
|
|
|
|
|
|
|
|
1408
|
|
|
|
|
|
|
=item POSITIVE INTEGER C - provide no more than this number of results. |
|
1409
|
|
|
|
|
|
|
|
|
1410
|
|
|
|
|
|
|
=back |
|
1411
|
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
Returns ARRAYREF of result definition HASHREFs. |
|
1413
|
|
|
|
|
|
|
|
|
1414
|
|
|
|
|
|
|
=cut |
|
1415
|
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
sub getTestResults { |
|
1417
|
0
|
|
|
0
|
1
|
|
my ($self,$test_id,$limit) = @_; |
|
1418
|
0
|
|
|
|
|
|
my $url = "index.php?/api/v2/get_results/$test_id"; |
|
1419
|
0
|
0
|
|
|
|
|
$url .= "&limit=$limit" if defined($limit); |
|
1420
|
0
|
|
|
|
|
|
return $self->_doRequest($url); |
|
1421
|
|
|
|
|
|
|
} |
|
1422
|
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
=head2 B |
|
1424
|
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
Convenience method to build the stepResult hashes seen in the custom options for getTestResults. |
|
1426
|
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
=cut |
|
1428
|
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
#Convenience method for building stepResults |
|
1430
|
|
|
|
|
|
|
sub buildStepResults { |
|
1431
|
0
|
|
|
0
|
1
|
|
my ($content,$expected,$actual,$status_id) = @_; |
|
1432
|
|
|
|
|
|
|
return { |
|
1433
|
0
|
|
|
|
|
|
content => $content, |
|
1434
|
|
|
|
|
|
|
expected => $expected, |
|
1435
|
|
|
|
|
|
|
actual => $actual, |
|
1436
|
|
|
|
|
|
|
status_id => $status_id |
|
1437
|
|
|
|
|
|
|
}; |
|
1438
|
|
|
|
|
|
|
} |
|
1439
|
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
1; |
|
1441
|
|
|
|
|
|
|
|
|
1442
|
|
|
|
|
|
|
__END__ |