testrail-ruby 0.0.31 → 0.1.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/endpoints.rb +1360 -697
- data/lib/testrail-ruby.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/testrail/endpoints_spec.rb +760 -68
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c42e4af387515e94b82360326dbafde088d09bc
|
4
|
+
data.tar.gz: fe2e2bf41e5bdd0b760add1090a0e8cc6d12fd3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c54a2f5e5d77b66959c80c355b7e529c435d2f1ea431f8ad32aa37aa456999a6410a5cba1c2607fd734ad6962be4ff1443ffbfcadd3a60044f2bf86d84a103
|
7
|
+
data.tar.gz: 45065c57e2f57f667b6f632032fa10d2e614aab8f18418335b2b86131ac5f0992a1a1b3ce81e74359a869d4e5d157a587d203d2b80c8e3d86b4aef5d0c085b52
|
data/lib/endpoints.rb
CHANGED
@@ -1,700 +1,1363 @@
|
|
1
1
|
module Endpoints
|
2
|
-
|
3
|
-
####
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
####get_cases
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
2
|
+
|
3
|
+
#### CASES ###############+++++5
|
4
|
+
|
5
|
+
####get_case###############+
|
6
|
+
# Returns an existing test case
|
7
|
+
# @param case_id [int] The id of the test case you want
|
8
|
+
# @example Code
|
9
|
+
# @client.get_case(1)
|
10
|
+
# @example Endpoint
|
11
|
+
# GET index.php?/api/v2/get_case/1
|
12
|
+
# @example Response
|
13
|
+
# {
|
14
|
+
# "created_by": 5,s
|
15
|
+
# "created_on": 1392300984,
|
16
|
+
# "custom_expected": "..",
|
17
|
+
# "custom_preconds": "..",
|
18
|
+
# "custom_steps": "..",
|
19
|
+
# "custom_steps_separated": [
|
20
|
+
# {
|
21
|
+
# "content": "Step 1",
|
22
|
+
# "expected": "Expected Result 1"
|
23
|
+
# },
|
24
|
+
# {
|
25
|
+
# "content": "Step 2",
|
26
|
+
# "expected": "Expected Result 2"
|
27
|
+
# }
|
28
|
+
# ],
|
29
|
+
# "estimate": "1m 5s",
|
30
|
+
# "estimate_forecast": null,
|
31
|
+
# "id": 1,
|
32
|
+
# "milestone_id": 7,
|
33
|
+
# "priority_id": 2,
|
34
|
+
# "refs": "RF-1, RF-2",
|
35
|
+
# "section_id": 1,
|
36
|
+
# "suite_id": 1,
|
37
|
+
# "title": "Change document attributes (author, title, organization)",
|
38
|
+
# "type_id": 4,
|
39
|
+
# "updated_by": 1,
|
40
|
+
# "updated_on": 1393586511
|
41
|
+
# }
|
42
|
+
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
43
|
+
def get_case(case_id)
|
44
|
+
send_get("get_case/#{case_id}")
|
45
|
+
end
|
46
|
+
|
47
|
+
####get_cases##############+
|
48
|
+
# Returns a list of test cases for a test suite or specific section in a test suite.
|
49
|
+
# @param project_id [int] The id of the project that contains your tests
|
50
|
+
# @param [Hash] opts
|
51
|
+
# @option opts [int] :suite_id The ID of the test suite (optional if the project is operating in single suite mode)
|
52
|
+
# @option opts [int] :section_id The ID of the section (optional)
|
53
|
+
# @option opts [unix timestamp] :created_after Only return test cases created after this date (as UNIX timestamp).
|
54
|
+
# @option opts [unix timestamp] :created_before Only return test cases created before this date (as UNIX timestamp).
|
55
|
+
# @option opts [int(list)] :created_by A comma-separated list of creators (user IDs) to filter by.
|
56
|
+
# @option opts [int(list)] :milestone_id A comma-separated list of milestone IDs to filter by (not available if the milestone field is disabled for the project).
|
57
|
+
# @option opts [int(list)] :priority_id A comma-separated list of priority IDs to filter by.
|
58
|
+
# @option opts [int(list)] :template_id A comma-separated list of template IDs to filter by (requires TestRail 5.2 or later)
|
59
|
+
# @option opts [int(list)] :type_id A comma-separated list of case type IDs to filter by.
|
60
|
+
# @option opts [unix timestamp] :updated_after Only return test cases updated after this date (as UNIX timestamp).
|
61
|
+
# @option opts [unix timestamp] :updated_before Only return test cases updated before this date (as UNIX timestamp).
|
62
|
+
# @option opts [int(list)] :updated_by A comma-separated list of users who updated test cases to filter by.
|
63
|
+
# @example Code Example
|
64
|
+
# @client.get_cases(1, {"suite_id":1, "section_id":1})
|
65
|
+
# @example Endpoint Example
|
66
|
+
# GET index.php?/api/v2/get_cases/1&suite_id=1§ion_id=1
|
67
|
+
# @example Response Example
|
68
|
+
# [
|
69
|
+
# { "id": 1, "title": "..", .. },
|
70
|
+
# { "id": 2, "title": "..", .. },
|
71
|
+
# ..
|
72
|
+
# ]
|
73
|
+
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
74
|
+
def get_cases(project_id, opts = {})
|
75
|
+
options = param_stringify(opts)
|
76
|
+
send_get("get_cases/#{project_id.to_s}&#{options}")
|
77
|
+
end
|
78
|
+
|
79
|
+
####add_case###############+
|
80
|
+
# Creates a new test case
|
81
|
+
# @param section_id [int] The ID of the section the test case should be added to
|
82
|
+
# @param [Hash] opts
|
83
|
+
# @option opts [string] :title The title of the test case (required)
|
84
|
+
# @option opts [int] :template_id The ID of the template (field layout) (requires TestRail 5.2 or later)
|
85
|
+
# @option opts [int] :type_id The ID of the case type
|
86
|
+
# @option opts [int] :priority_id The ID of the case priority
|
87
|
+
# @option opts [timespan] :estimate The estimate, e.g. "30s" or "1m 45s"
|
88
|
+
# @option opts [int] :milestone_id The ID of the milestone to link to the test case
|
89
|
+
# @option opts [string] :refs A comma-separated list of references/requirements
|
90
|
+
# @option opts [varies] :custom_fields Custom fields are supported as well and must be submitted with their system name, prefixed with 'custom_'
|
91
|
+
# @example Code Example
|
92
|
+
# @client.add_case(1, {"title":"testCaseName", "type_id":1})
|
93
|
+
# @example Endpoint Example
|
94
|
+
# index.php?/api/v2/add_case/1&title="foo"&type_id=1
|
95
|
+
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
96
|
+
# @note For more information about custom fields, see guroc docs
|
97
|
+
def add_case(section_id, opts = {})
|
98
|
+
send_post("add_case/#{section_id.to_s}", opts)
|
99
|
+
end
|
100
|
+
|
101
|
+
####update_case############+
|
102
|
+
# Update test result by case id
|
103
|
+
# @param case_id [int] The id of the test case
|
104
|
+
# @param [Hash] opts
|
105
|
+
# @option opts [string] :title The title of the test case (required)
|
106
|
+
# @option opts [int] :template_id The ID of the template (field layout) (requires TestRail 5.2 or later)
|
107
|
+
# @option opts [int] :type_id The ID of the case type
|
108
|
+
# @option opts [int] :priority_id The ID of the case priority
|
109
|
+
# @option opts [timespan] :estimate The estimate, e.g. "30s" or "1m 45s"
|
110
|
+
# @option opts [int] :milestone_id The ID of the milestone to link to the test case
|
111
|
+
# @option opts [string] :refs A comma-separated list of references/requirements
|
112
|
+
# @option opts [varies] :custom_fields Custom fields are supported as well and must be submitted with their system name, prefixed with 'custom_'
|
113
|
+
# @example Code
|
114
|
+
# client.update_case(1, {"title": "testCaseName", "type_id": 1})
|
115
|
+
# @example Endpoint
|
116
|
+
# index.php?/api/v2/update_case/1
|
117
|
+
# @example Body
|
118
|
+
# {\"title\":\"testCaseName\",\"type_id\":1}
|
119
|
+
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
120
|
+
def update_case(case_id, opts = {})
|
121
|
+
send_post("update_case/#{case_id.to_s}", opts)
|
122
|
+
end
|
123
|
+
|
124
|
+
####delete_case############+
|
125
|
+
# Delete test case by case id
|
126
|
+
# @param case_id [int] The id of the test case
|
127
|
+
# @param [Hash] opts
|
128
|
+
# @example Code Example
|
129
|
+
# client.delete_case(1, {"title": "testCaseName", "type_id": 1})
|
130
|
+
# @example Endpoint Example
|
131
|
+
# index.php?/api/v2/delete_case/1
|
132
|
+
# @example Body Example
|
133
|
+
# {\"title\":\"testCaseName\",\"type_id\":1}
|
134
|
+
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
135
|
+
def delete_case(case_id, opts = {})
|
136
|
+
send_post("delete_case/#{case_id.to_s}", opts)
|
137
|
+
end
|
138
|
+
|
139
|
+
#### SUITES ##############+++++5
|
140
|
+
|
141
|
+
####get_suite##############+
|
142
|
+
# Return suite by suite id
|
143
|
+
# @param suite_id [int] The suite id
|
144
|
+
# @param [Hash] opts
|
145
|
+
# @example Code
|
146
|
+
# client.get_suit(1)
|
147
|
+
# @example Endpoint
|
148
|
+
# index.php?/api/v2/get_suite/1
|
149
|
+
# @example Response
|
150
|
+
# {
|
151
|
+
# "description": "..",
|
152
|
+
# "id": 1,
|
153
|
+
# "name": "Setup & Installation",
|
154
|
+
# "project_id": 1,
|
155
|
+
# "url": "http://<server>/testrail/index.php?/suites/view/1"
|
156
|
+
# }
|
157
|
+
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
158
|
+
def get_suite(suite_id)
|
159
|
+
send_get("get_suite/#{suite_id.to_s}")
|
160
|
+
end
|
161
|
+
|
162
|
+
####get_suites#############+
|
163
|
+
# Return all suites in project by project id
|
164
|
+
# @param project_id (see get_cases)
|
165
|
+
# @param [Hash] opts
|
166
|
+
# @example Code
|
167
|
+
# client.get_suites(1)
|
168
|
+
# @example Endpoint
|
169
|
+
# index.php?/api/v2/get_suites/:project_id
|
170
|
+
# @example Response
|
171
|
+
# [
|
172
|
+
# { "id": 1, "name": "Setup & Installation", .. },
|
173
|
+
# { "id": 2, "name": "Document Editing", .. }
|
174
|
+
# ]
|
175
|
+
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
176
|
+
def get_suites(project_id)
|
177
|
+
send_get("get_suites/#{project_id.to_s}")
|
178
|
+
end
|
179
|
+
|
180
|
+
####add_suite##############+
|
181
|
+
# Add a test suite
|
182
|
+
# @param project_id [int] The id of the project containing suites
|
183
|
+
# @param [Hash] opts
|
184
|
+
# @option opts [string] :name Name of new suite
|
185
|
+
# @option opts [string] :description Description of new suite
|
186
|
+
# @example Code
|
187
|
+
# client.add_suite(1, {"name": "suite name", "description": "description text"})
|
188
|
+
# @example Endpoint
|
189
|
+
# index.php?/api/v2/add_suite/1
|
190
|
+
# @example Request Body
|
191
|
+
# {"name":"suite name","description": "description of test suite"}
|
192
|
+
# @example Response
|
193
|
+
# { "name": "suite name",
|
194
|
+
# "description": "description text"
|
195
|
+
# }
|
196
|
+
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
197
|
+
def add_suite(project_id, opts = {})
|
198
|
+
send_post("add_suite/#{project_id.to_s}", opts)
|
199
|
+
end
|
200
|
+
|
201
|
+
####update_suite###########+
|
202
|
+
# update a test suite
|
203
|
+
# @param suite_id [int] The suite id
|
204
|
+
# @param [Hash] opts
|
205
|
+
# @option opts [string] :name Name of new suite
|
206
|
+
# @option opts [string] :description Description of new suite
|
207
|
+
# @example Endpoint Example
|
208
|
+
# index.php?/api/v2/update_suite/:suite_id
|
209
|
+
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
210
|
+
def update_suite(suite_id, opts = {})
|
211
|
+
send_post("update_suite/#{suite_id.to_s}", opts)
|
212
|
+
end
|
213
|
+
|
214
|
+
####delete_suite###########+
|
215
|
+
# Delete a test suite
|
216
|
+
# @param suite_id [int] The suite id
|
217
|
+
# @example Code
|
218
|
+
# client.delete_suite(1)
|
219
|
+
# @example Endpoint
|
220
|
+
# index.php?/api/v2/delete_suite/1
|
221
|
+
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
222
|
+
def delete_suite(suite_id, opts = {})
|
223
|
+
send_post("delete_suite/#{suite_id.to_s}", opts)
|
224
|
+
end
|
225
|
+
|
226
|
+
#### SECTIONS ############+++++5
|
227
|
+
|
228
|
+
####get_section#############
|
229
|
+
# Return section by id
|
230
|
+
# @param [int] section_id
|
231
|
+
# @example Endpoint
|
232
|
+
# GET index.php?/api/v2/get_section/1
|
233
|
+
# @example Code
|
234
|
+
# client.get_section(2)
|
235
|
+
# @example Return
|
236
|
+
# {
|
237
|
+
# "depth": 0,
|
238
|
+
# "description": null,
|
239
|
+
# "display_order": 1,
|
240
|
+
# "id": 1,
|
241
|
+
# "name": "section name",
|
242
|
+
# "parent_id": 1,
|
243
|
+
# "suite_id": 2
|
244
|
+
# }
|
245
|
+
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
246
|
+
def get_section(section_id)
|
247
|
+
send_get("get_section/#{section_id.to_s}")
|
248
|
+
end
|
249
|
+
|
250
|
+
####get_sections############
|
251
|
+
# Get sections for suite
|
252
|
+
# @param [int] project_id
|
253
|
+
# @param [Hash] opts
|
254
|
+
# @options opts [int] :suite_id
|
255
|
+
# @example Endpoint
|
256
|
+
# GET index.php?/api/v2/get_sections/1&suite_id=2
|
257
|
+
# @example Code
|
258
|
+
# client.get_sections(1, {"suite_id":2})
|
259
|
+
# @example Return
|
260
|
+
# [
|
261
|
+
# {
|
262
|
+
# "depth": 0,
|
263
|
+
# "display_order": 1,
|
264
|
+
# "id": 1,
|
265
|
+
# "name": "Prerequisites",
|
266
|
+
# "parent_id": null,
|
267
|
+
# "suite_id": 1
|
268
|
+
# },
|
269
|
+
# {
|
270
|
+
# "depth": 0,
|
271
|
+
# "display_order": 2,
|
272
|
+
# "id": 2,
|
273
|
+
# "name": "Documentation & Help",
|
274
|
+
# "parent_id": null,
|
275
|
+
# "suite_id": 1
|
276
|
+
# },
|
277
|
+
# {
|
278
|
+
# "depth": 1, // A child section
|
279
|
+
# "display_order": 3,
|
280
|
+
# "id": 3,
|
281
|
+
# "name": "Licensing & Terms",
|
282
|
+
# "parent_id": 2, // Points to the parent section
|
283
|
+
# "suite_id": 1
|
284
|
+
# },
|
285
|
+
# ..
|
286
|
+
# ]
|
287
|
+
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
288
|
+
def get_sections(project_id, opts = {})
|
289
|
+
options = param_stringify(opts)
|
290
|
+
send_get("get_sections/#{project_id.to_s}&#{options}")
|
291
|
+
end
|
292
|
+
|
293
|
+
####add_section#############
|
294
|
+
# Add section to suite
|
295
|
+
# @param [int] project_id
|
296
|
+
# @param [Hash] opts
|
297
|
+
# @option opts [Int] suite_id
|
298
|
+
# @option opts [String] name
|
299
|
+
# @option opts [Int] parent_id
|
300
|
+
# @example Endpoint
|
301
|
+
# POST index.php?/api/v2/add_section/1
|
302
|
+
# @example Code
|
303
|
+
# @client.add_section(1, {"suite_id": 2, "name": "Name of new section.", "parent_id": 1})
|
304
|
+
# @example Request
|
305
|
+
# {
|
306
|
+
# "name": "Name of new section.",
|
307
|
+
# "suite_id": 2,
|
308
|
+
# "parent_id": 1
|
309
|
+
# }
|
310
|
+
# @example Return
|
311
|
+
# If successful, this method returns the updated section using the same response format as get_section.
|
312
|
+
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
313
|
+
def add_section(project_id, opts = {})
|
314
|
+
send_post("add_section/#{project_id.to_s}", opts)
|
315
|
+
end
|
316
|
+
|
317
|
+
####update_section##########
|
318
|
+
# Update a section
|
319
|
+
# @param [Int] section_id
|
320
|
+
# @param [Hash] opts
|
321
|
+
# @option opts [string] description
|
322
|
+
# @option opts [string] name
|
323
|
+
# @example Endpoint
|
324
|
+
# POST index.php?/api/v2/update_section/1
|
325
|
+
# @example Code
|
326
|
+
# index.php?/api/v2/update_section/1
|
327
|
+
# @example Request
|
328
|
+
# {
|
329
|
+
# "name": "updated section name",
|
330
|
+
# "description": "updated description"
|
331
|
+
# }
|
332
|
+
# @example Return
|
333
|
+
# If successful, this method returns the updated section using the same response format as get_section.
|
334
|
+
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
335
|
+
def update_section(section_id, opts = {})
|
336
|
+
send_post("update_section/#{section_id.to_s}", opts)
|
337
|
+
end
|
338
|
+
|
339
|
+
####delete_section###########
|
340
|
+
# Delete a section WARNING: Destructive
|
341
|
+
# @param [Int] section_id
|
342
|
+
# @example Endpoint
|
343
|
+
# POST index.php?/api/v2/delete_section/1
|
344
|
+
# @example Code
|
345
|
+
# client.delete_section(1)
|
346
|
+
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
347
|
+
def delete_section(section_id, opts = {})
|
348
|
+
send_post("delete_section/#{section_id}", opts)
|
349
|
+
end
|
350
|
+
|
351
|
+
#### MILESTONES ##########+++++5
|
352
|
+
|
353
|
+
####get_milestone############
|
354
|
+
# Get milestone by milestone_id
|
355
|
+
# @param [Int] milestone_id
|
356
|
+
# @example Endpoint
|
357
|
+
# GET index.php?/api/v2/get_milestone/1
|
358
|
+
# @example Code
|
359
|
+
# client.get_milestone(1)
|
360
|
+
# @example Return
|
361
|
+
# {
|
362
|
+
# "completed_on": 1389968184,
|
363
|
+
# "description": "...",
|
364
|
+
# "due_on": 1391968184,
|
365
|
+
# "id": 1,
|
366
|
+
# "is_completed": true,
|
367
|
+
# "name": "Release 1.5",
|
368
|
+
# "project_id": 1,
|
369
|
+
# "url": "http://<server>/testrail/index.php?/milestones/view/1"
|
370
|
+
# }
|
371
|
+
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
372
|
+
def get_milestone(milestone_id)
|
373
|
+
send_get("get_milestone/#{milestone_id.to_s}")
|
374
|
+
end
|
375
|
+
|
376
|
+
####get_milestones##########
|
377
|
+
# Get project milestones by project id
|
378
|
+
# @param [int] project_id
|
379
|
+
# @param [Hash] opts (optional)
|
380
|
+
# @options opts [bool] is_started
|
381
|
+
# @options opts [bool] is_completed
|
382
|
+
# @example Endpoint
|
383
|
+
# index.php?/api/v2/get_milestones/1&is_completed=0&is_started=1
|
384
|
+
# @example Code
|
385
|
+
# client.get_milestones(1, {"is_completed": 0, "is_started": 1})
|
386
|
+
# @example Return
|
387
|
+
# [{ "id": 1, "name": "foo", .. }, { "id": 1, "name": "bar, .. }]
|
388
|
+
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
389
|
+
def get_milestones(project_id, opts = {})
|
390
|
+
options = param_stringify(opts)
|
391
|
+
send_get("get_milestones/#{project_id.to_s}&#{options}")
|
392
|
+
end
|
393
|
+
|
394
|
+
####add_milestone###########
|
395
|
+
# Add milestone to project id
|
396
|
+
# @param project_id [int]
|
397
|
+
# @param [Hash] opts
|
398
|
+
# @option opts [string] name
|
399
|
+
# @option opts [string] description
|
400
|
+
# @option opts [timestamp] due_on
|
401
|
+
# @option opts [int] parent_id
|
402
|
+
# @option opts [timestamp] start_on
|
403
|
+
# @example Endpoint
|
404
|
+
# index.php?/api/v2/add_milestone/1
|
405
|
+
# @example Code
|
406
|
+
# client.add_milestone(1, {"name": "Release 2.0", "due_on": 1394596385})
|
407
|
+
# @example Request
|
408
|
+
# {"name": "Release 2.0", "due_on": 1394596385}
|
409
|
+
# @example Return
|
410
|
+
# If successful, this method returns the updated section using the same response format as get_section.
|
411
|
+
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
412
|
+
def add_milestone(project_id, opts = {})
|
413
|
+
send_post("add_milestone/#{project_id.to_s}", opts)
|
414
|
+
end
|
415
|
+
|
416
|
+
####update_milestone########
|
417
|
+
# Add milestone to project id
|
418
|
+
# @param [Int] milestone_id
|
419
|
+
# @param [Hash] opts
|
420
|
+
# @option opts [bool] is_completed
|
421
|
+
# @option opts [bool] is_started
|
422
|
+
# @option opts [int] parent_id
|
423
|
+
# @option opts [timestamp] start_on
|
424
|
+
# @example Endpoint
|
425
|
+
# index.php?/api/v2/update_milestone/:milestone_id
|
426
|
+
# @example Code
|
427
|
+
# client.update_milestone(1, {"is_completed": false, "is_started": false, "parent_id": 1, "start_on": 1394596385})
|
428
|
+
# @example Request
|
429
|
+
# {"is_completed": false, "is_started": false, "parent_id": 1, "start_on": 1394596385}
|
430
|
+
# @example Return
|
431
|
+
# If successful, this method returns the updated section using the same response format as get_section.
|
432
|
+
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
433
|
+
def update_milestone(milestone_id, opts = {})
|
434
|
+
send_post("update_milestone/#{milestone_id.to_s}", opts)
|
435
|
+
end
|
436
|
+
|
437
|
+
####delete_milestone########
|
438
|
+
# Add milestone to project id WARNING: Destructive
|
439
|
+
# @param [Int] milestone_id
|
440
|
+
# @example Endpoint
|
441
|
+
# index.php?/api/v2/delete_milestone/1
|
442
|
+
# @example Code
|
443
|
+
# client.delete_milestone(1)
|
444
|
+
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
445
|
+
def delete_milestone(milestone_id, opts = {})
|
446
|
+
send_post("delete_milestone/#{milestone_id.to_s}", opts)
|
447
|
+
end
|
448
|
+
|
449
|
+
#### PLANS ###########+++++++++9
|
450
|
+
|
451
|
+
####get_plan################
|
452
|
+
# Get plan by id
|
453
|
+
# @param [Int] plan_id
|
454
|
+
# @example Endpoint
|
455
|
+
# GET index.php?/api/v2/get_plan/1
|
456
|
+
# @example Code
|
457
|
+
# client.get_plan(1)
|
458
|
+
# @example Return
|
459
|
+
# {
|
460
|
+
# "assignedto_id": null,
|
461
|
+
# "blocked_count": 2,
|
462
|
+
# "completed_on": null,
|
463
|
+
# "created_by": 1,
|
464
|
+
# "created_on": 1393845644,
|
465
|
+
# "custom_status1_count": 0,
|
466
|
+
# "custom_status2_count": 0,
|
467
|
+
# "custom_status3_count": 0,
|
468
|
+
# "custom_status4_count": 0,
|
469
|
+
# "custom_status5_count": 0,
|
470
|
+
# "custom_status6_count": 0,
|
471
|
+
# "custom_status7_count": 0,
|
472
|
+
# "description": null,
|
473
|
+
# "entries": [
|
474
|
+
# {
|
475
|
+
# "id": "3933d74b-4282-4c1f-be62-a641ab427063",
|
476
|
+
# "name": "File Formats",
|
477
|
+
# "runs": [
|
478
|
+
# {
|
479
|
+
# "assignedto_id": 6,
|
480
|
+
# "blocked_count": 0,
|
481
|
+
# "completed_on": null,
|
482
|
+
# "config": "Firefox, Ubuntu 12",
|
483
|
+
# "config_ids": [
|
484
|
+
# 2,
|
485
|
+
# 6
|
486
|
+
# ],
|
487
|
+
# "custom_status1_count": 0,
|
488
|
+
# "custom_status2_count": 0,
|
489
|
+
# "custom_status3_count": 0,
|
490
|
+
# "custom_status4_count": 0,
|
491
|
+
# "custom_status5_count": 0,
|
492
|
+
# "custom_status6_count": 0,
|
493
|
+
# "custom_status7_count": 0,
|
494
|
+
# "description": null,
|
495
|
+
# "entry_id": "3933d74b-4282-4c1f-be62-a641ab427063",
|
496
|
+
# "entry_index": 1,
|
497
|
+
# "failed_count": 2,
|
498
|
+
# "id": 81,
|
499
|
+
# "include_all": false,
|
500
|
+
# "is_completed": false,
|
501
|
+
# "milestone_id": 7,
|
502
|
+
# "name": "File Formats",
|
503
|
+
# "passed_count": 2,
|
504
|
+
# "plan_id": 80,
|
505
|
+
# "project_id": 1,
|
506
|
+
# "retest_count": 1,
|
507
|
+
# "suite_id": 4,
|
508
|
+
# "untested_count": 3,
|
509
|
+
# "url": "http://<server>/testrail/index.php?/runs/view/81"
|
510
|
+
# },
|
511
|
+
# {
|
512
|
+
# ..
|
513
|
+
# }
|
514
|
+
# ],
|
515
|
+
# "suite_id": 4
|
516
|
+
# }
|
517
|
+
# ],
|
518
|
+
# "failed_count": 2,
|
519
|
+
# "id": 80,
|
520
|
+
# "is_completed": false,
|
521
|
+
# "milestone_id": 7,
|
522
|
+
# "name": "System test",
|
523
|
+
# "passed_count": 5,
|
524
|
+
# "project_id": 1,
|
525
|
+
# "retest_count": 1,
|
526
|
+
# "untested_count": 6,
|
527
|
+
# "url": "http://<server>/testrail/index.php?/plans/view/80"
|
528
|
+
# }
|
529
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
530
|
+
def get_plan(plan_id)
|
531
|
+
send_get("get_plan/#{plan_id.to_s}")
|
532
|
+
end
|
533
|
+
|
534
|
+
####get_plans###############
|
535
|
+
# @param project_id [int]
|
536
|
+
# @param [Hash] opts
|
537
|
+
# @example Endpoint
|
538
|
+
# index.php?/api/v2/get_plans/:project_id
|
539
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
540
|
+
# Get plans in project by project id
|
541
|
+
# @param [Int] project_id
|
542
|
+
# @param [Hash] opts
|
543
|
+
# @option opts [timestamp] created_after
|
544
|
+
# @option opts [timestamp] created_before
|
545
|
+
# @option opts [string] created_by
|
546
|
+
# @option opts [bool] is_completed
|
547
|
+
# @option opts [int] limit
|
548
|
+
# @option opts [int] offset
|
549
|
+
# @option opts [int(list)] milestone_id
|
550
|
+
# @example Endpoint
|
551
|
+
# GET index.php?/api/v2/get_plans/1
|
552
|
+
# @example Code
|
553
|
+
#
|
554
|
+
# @example Request
|
555
|
+
# {"is_completed":1, "milestone_id": 1 }
|
556
|
+
# @example Return
|
557
|
+
# {
|
558
|
+
#
|
559
|
+
# }
|
560
|
+
# @see
|
561
|
+
def get_plans(project_id, opts = {})
|
562
|
+
options = param_stringify(opts)
|
563
|
+
puts options
|
564
|
+
send_get("get_plans/#{project_id.to_s}&#{options}")
|
565
|
+
end
|
566
|
+
|
567
|
+
####add_plan################
|
568
|
+
# Creates a new test plan.
|
569
|
+
# @param [Int] project_id
|
570
|
+
# @param [Hash] opts
|
571
|
+
# @option opts [string] name
|
572
|
+
# @option opts [string] description
|
573
|
+
# @option opts [int] milestone_id
|
574
|
+
# @option opts [array] entries
|
575
|
+
# @example Endpoint
|
576
|
+
# POST index.php?/api/v2/add_plan/1
|
577
|
+
# @example Code
|
578
|
+
# client.add_plan(1, {"name": "foo", "description": "bar"})
|
579
|
+
# @example Request (plain)
|
580
|
+
# {
|
581
|
+
# "name": "System test",
|
582
|
+
# "entries": [
|
583
|
+
# {
|
584
|
+
# "suite_id": 1,
|
585
|
+
# "name": "Custom run name",
|
586
|
+
# "assignedto_id": 1
|
587
|
+
# },
|
588
|
+
# {
|
589
|
+
# "suite_id": 1,
|
590
|
+
# "include_all": false,
|
591
|
+
# "case_ids": [1,2,3,5]
|
592
|
+
# }
|
593
|
+
# ]
|
594
|
+
# }
|
595
|
+
# @example Request (With configurations. See gurock docs for more info)
|
596
|
+
# {
|
597
|
+
# "name": "System test",
|
598
|
+
# "entries": [
|
599
|
+
# {
|
600
|
+
# "suite_id": 1,
|
601
|
+
# "include_all": true,
|
602
|
+
# "config_ids": [1, 2, 4, 5, 6],
|
603
|
+
# "runs": [
|
604
|
+
# {
|
605
|
+
# "include_all": false,
|
606
|
+
# "case_ids": [1, 2, 3],
|
607
|
+
# "assignedto_id": 1,
|
608
|
+
# "config_ids": [2, 5]
|
609
|
+
# },
|
610
|
+
# {
|
611
|
+
# "include_all": false,
|
612
|
+
# "case_ids": [1, 2, 3, 5, 8],
|
613
|
+
# "assignedto_id": 2,
|
614
|
+
# "config_ids": [2, 6]
|
615
|
+
# }
|
616
|
+
# ..
|
617
|
+
# ]
|
618
|
+
# },
|
619
|
+
# ..
|
620
|
+
# ]
|
621
|
+
# }
|
622
|
+
# @example Return
|
623
|
+
# If successful, this method returns the updated section using the same response format as get_section.
|
624
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
625
|
+
def add_plan(project_id, opts = {})
|
626
|
+
send_post("add_plan/#{project_id.to_s}", opts)
|
627
|
+
end
|
628
|
+
|
629
|
+
####add_plan_entry##########
|
630
|
+
# Add plan entries by plan id
|
631
|
+
# @param [Int] plan_id
|
632
|
+
# @param [Hash] opts
|
633
|
+
# @option opts [int] suite_id
|
634
|
+
# @option opts [string] name
|
635
|
+
# @option opts [string] description
|
636
|
+
# @option opts [int] assignedto_id
|
637
|
+
# @option opts [bool] include_all
|
638
|
+
# @option opts [array] case_ids
|
639
|
+
# @option opts [array] config_ids
|
640
|
+
# @option opts [array] runs
|
641
|
+
# @example Endpoint
|
642
|
+
# index.php?/api/v2/add_plan_entry/1
|
643
|
+
# @example Code
|
644
|
+
# options =
|
645
|
+
# {
|
646
|
+
# "suite_id": 1,
|
647
|
+
# "assignedto_id": 1, // Default assignee
|
648
|
+
# "include_all": true, // Default selection
|
649
|
+
# "config_ids": [1, 2, 4, 5, 6],
|
650
|
+
# "runs": [
|
651
|
+
# {
|
652
|
+
# "include_all": false, // Override selection
|
653
|
+
# "case_ids": [1, 2, 3],
|
654
|
+
# "config_ids": [2, 5]
|
655
|
+
# },
|
656
|
+
# {
|
657
|
+
# "include_all": false, // Override selection
|
658
|
+
# "case_ids": [1, 2, 3, 5, 8],
|
659
|
+
# "assignedto_id": 2, // Override assignee
|
660
|
+
# "config_ids": [2, 6]
|
661
|
+
# }
|
662
|
+
# ..
|
663
|
+
# ]
|
664
|
+
# }
|
665
|
+
# client.add_plan_entry(1, options)
|
666
|
+
# @example Request
|
667
|
+
# {
|
668
|
+
# "suite_id": 1,
|
669
|
+
# "assignedto_id": 1, // Default assignee
|
670
|
+
# "include_all": true, // Default selection
|
671
|
+
# "config_ids": [1, 2, 4, 5, 6],
|
672
|
+
# "runs": [
|
673
|
+
# {
|
674
|
+
# "include_all": false, // Override selection
|
675
|
+
# "case_ids": [1, 2, 3],
|
676
|
+
# "config_ids": [2, 5]
|
677
|
+
# },
|
678
|
+
# {
|
679
|
+
# "include_all": false, // Override selection
|
680
|
+
# "case_ids": [1, 2, 3, 5, 8],
|
681
|
+
# "assignedto_id": 2, // Override assignee
|
682
|
+
# "config_ids": [2, 6]
|
683
|
+
# }
|
684
|
+
# ..
|
685
|
+
# ]
|
686
|
+
# }
|
687
|
+
# @example Return
|
688
|
+
# If successful, this method returns the new test plan entry including test runs using the same response format as the entries field of get_plan, but for a single entry instead of a list of entries.
|
689
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
690
|
+
def add_plan_entry(plan_id, opts = {})
|
691
|
+
send_post("add_plan_entry/#{plan_id.to_s}", opts)
|
692
|
+
end
|
693
|
+
|
694
|
+
####update_plan#############
|
695
|
+
# Updates an existing test plan (partial updates are supported, i.e. you can submit and update specific fields only).
|
696
|
+
# @param [Int] plan_id
|
697
|
+
# @param [Hash] opts
|
698
|
+
# @option opts [string] name
|
699
|
+
# @option opts [string] description
|
700
|
+
# @option opts [int] milestone_id
|
701
|
+
# @example Endpoint
|
702
|
+
# POST index.php?/api/v2/update_plan/1
|
703
|
+
# @example Code
|
704
|
+
# client.update_plan(1, {"name": "foo", "description": "bar"})
|
705
|
+
# @example Return
|
706
|
+
# If successful, this method returns the updated test plan using the same response format as get_plan.
|
707
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
708
|
+
def update_plan(plan_id, opts = {})
|
709
|
+
send_post("update_plan/#{plan_id.to_s}", opts)
|
710
|
+
end
|
711
|
+
|
712
|
+
####update_plan_entry#######
|
713
|
+
# Updates one or more existing test runs in a plan (partial updates are supported, i.e. you can submit and update specific fields only).
|
714
|
+
# @param [int] plan_id
|
715
|
+
# @param [int] entry_id
|
716
|
+
# @param [Hash] opts
|
717
|
+
# @option opts [string] name
|
718
|
+
# @option opts [string] description
|
719
|
+
# @option opts [int] assignedto_id
|
720
|
+
# @option opts [bool] include_all
|
721
|
+
# @option opts [array] case_ids
|
722
|
+
# @example Endpoint
|
723
|
+
# POST index.php?/api/v2/update_plan_entry/1/1
|
724
|
+
# @example Code
|
725
|
+
# client.update_plan_entry(1, 1, {"name": "foo", "description": "bar"})
|
726
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
727
|
+
def update_plan_entry(plan_id, entry_id, opts = {})
|
728
|
+
send_post("update_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
|
729
|
+
end
|
730
|
+
|
731
|
+
####close_plan##############
|
732
|
+
# Closes an existing test plan and archives its test runs & results. WARNING: This can not be undone.
|
733
|
+
# @param [int] plan_id
|
734
|
+
# @example Endpoint
|
735
|
+
# POST index.php?/api/v2/close_plan/1
|
736
|
+
# @example Code
|
737
|
+
# client.close_plan(1)
|
738
|
+
# @example Response
|
739
|
+
# If successful, this method returns the closed test plan using the same response format as get_plan.
|
740
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
741
|
+
def close_plan(plan_id, opts = {})
|
742
|
+
send_post("close_plan/#{plan_id.to_s}", opts)
|
743
|
+
end
|
744
|
+
|
745
|
+
####delete_plan#############
|
746
|
+
# Deletes an existing test plan. WARNING: This can not be undone. Permenantly deletes ALL test runs and results in plan
|
747
|
+
# @param [int] plan_id
|
748
|
+
# @example Endpoint
|
749
|
+
# POST index.php?/api/v2/delete_plan/1
|
750
|
+
# @example Code
|
751
|
+
# client.delete_plan(1)
|
752
|
+
# @example Response
|
753
|
+
# If successful, this method returns the closed test plan using the same response format as get_plan.
|
754
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
755
|
+
def delete_plan(plan_id, opts = {})
|
756
|
+
send_post("delete_plan/#{plan_id.to_s}", opts)
|
757
|
+
end
|
758
|
+
|
759
|
+
####delete_plan_by_entry####
|
760
|
+
# Deletes one or more existing test runs from a plan. WARNING: Deletes test results
|
761
|
+
# @param [int] plan_id
|
762
|
+
# @param [int] entry_id
|
763
|
+
# @example Endpoint
|
764
|
+
# POST index.php?/api/v2/delete_plan_entry/1/1
|
765
|
+
# @example Code
|
766
|
+
# client.delete_plan_entry(1, 1)
|
767
|
+
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
768
|
+
def delete_plan_entry(plan_id, entry_id, opts = {})
|
769
|
+
send_post("delete_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
|
770
|
+
end
|
771
|
+
|
772
|
+
#### PROJECTS ############+++++5
|
773
|
+
|
774
|
+
####get_project#############
|
775
|
+
# Get project by project id
|
776
|
+
# @param project_id [int]
|
777
|
+
# @example Endpoint Example
|
778
|
+
# GET index.php?/api/v2/get_project/1
|
779
|
+
# @example Code
|
780
|
+
# client.get_project(1)
|
781
|
+
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
782
|
+
def get_project(project_id, opts = {})
|
783
|
+
options = param_stringify(opts)
|
784
|
+
send_get("get_project/#{project_id.to_s}&#{options}")
|
785
|
+
end
|
786
|
+
|
787
|
+
####get_projects############
|
788
|
+
# Get all projects
|
789
|
+
# @param [Hash] opts
|
790
|
+
# @option opts [bool] :is_completed 1 == completed projects, 2 == active projects
|
791
|
+
# @example Endpoint Example
|
792
|
+
# GET index.php?/api/v2/get_projects
|
793
|
+
# @example Code Example [get all projects]
|
794
|
+
# client.get_projects
|
795
|
+
# @example Code Example [get active projects]
|
796
|
+
# client.get_projects({'is_completed':0})
|
797
|
+
# @example Code Example [get completed projects]
|
798
|
+
# client.get_projects({'is_completed':1})
|
799
|
+
# @example Response Example
|
800
|
+
# [
|
801
|
+
# { "id": 1, "name": "Project1", ... },
|
802
|
+
# { "id": 2, "name": "Project2", ... },
|
803
|
+
# ..
|
804
|
+
# ]
|
805
|
+
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
806
|
+
def get_projects(opts = {})
|
807
|
+
options = param_stringify(opts)
|
808
|
+
send_get("get_projects&#{options}")
|
809
|
+
end
|
810
|
+
|
811
|
+
####add_project#############
|
812
|
+
# Creates a new project (admin status required)
|
813
|
+
# @param [Hash] opts
|
814
|
+
# @option [string] name
|
815
|
+
# @option [string] announcement
|
816
|
+
# @option [bool] show_announcement
|
817
|
+
# @option [int] suite_mode
|
818
|
+
# @example Endpoint Example
|
819
|
+
# POST index.php?/api/v2/add_project
|
820
|
+
# @example Code
|
821
|
+
# client.add_project({"name": "foo", "announcement": "bar", "show_announcement": true, "suite_mode": 1})
|
822
|
+
# @example Request
|
823
|
+
# {"name": "foo", "announcement": "bar", "show_announcement": true, "suite_mode": 1}
|
824
|
+
# @example Response
|
825
|
+
# see get_project
|
826
|
+
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
827
|
+
def add_project(opts = {})
|
828
|
+
send_post("add_project", opts)
|
829
|
+
end
|
830
|
+
|
831
|
+
####update_project##########
|
832
|
+
# Updates an existing project (admin status required; partial updates are supported, i.e. you can submit and update specific fields only).
|
833
|
+
# @param project_id [int] ID of project to update
|
834
|
+
# @param [Hash] opts
|
835
|
+
# @option [string] name
|
836
|
+
# @option [string] announcement
|
837
|
+
# @option [bool] show_announcement
|
838
|
+
# @option [int] suite_mode
|
839
|
+
# @option [bool] is_completed
|
840
|
+
# @example Endpoint Example
|
841
|
+
# POST index.php?/api/v2/update_project/:project_id
|
842
|
+
# @example Code
|
843
|
+
# client.update_project(1, {"name": "foo", "announcement": "bar", "show_announcement": true, "suite_mode": 1, "is_completed": true})
|
844
|
+
# @example Request
|
845
|
+
# {"name": "foo", "announcement": "bar", "show_announcement": true, "suite_mode": 1, "is_completed": true}
|
846
|
+
# @example Response
|
847
|
+
# see get_project
|
848
|
+
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
849
|
+
def update_project(project_id, opts = {})
|
850
|
+
send_post("update_project/#{project_id.to_s}", opts)
|
851
|
+
end
|
852
|
+
|
853
|
+
####delete_project##########
|
854
|
+
# Delete an existing project
|
855
|
+
# @param project_id [int] The project you want to delete
|
856
|
+
# @example Endpoint Example
|
857
|
+
# POST index.php?/api/v2/delete_project/1
|
858
|
+
# @example Code
|
859
|
+
# client.delete_project(1)
|
860
|
+
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
861
|
+
def delete_project(project_id, opts = {})
|
862
|
+
send_post("delete_project/#{project_id.to_s}", opts)
|
863
|
+
end
|
864
|
+
|
865
|
+
#### RESULTS ###########+++++++7
|
866
|
+
|
867
|
+
####get_results#############
|
868
|
+
# Returns a list of test results for a test
|
869
|
+
# @param [int] test_id
|
870
|
+
# @param [Hash] opts
|
871
|
+
# @option opts [int] limit
|
872
|
+
# @option opts [int] offset
|
873
|
+
# @option opts [int(list)] status_id
|
874
|
+
# @example Endpoint Example
|
875
|
+
# GET index.php?/api/v2/get_results/1&status_id=4,5&limit=10
|
876
|
+
# @example Code
|
877
|
+
# client.get_results(1, {"status_id": 4, "limit": 10})
|
878
|
+
# @example Request
|
879
|
+
# {"status_id": 4, "limit": 10}
|
880
|
+
# @example Return
|
881
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
882
|
+
def get_results(test_id, opts = {})
|
883
|
+
options = param_stringify(opts)
|
884
|
+
send_get("get_results/#{test_id.to_s}&#{options}")
|
885
|
+
end
|
886
|
+
|
887
|
+
####get_results_for_case####
|
888
|
+
# Returns a list of test results for a test run and case combination
|
889
|
+
# @param [int] run_id
|
890
|
+
# @param [int] case_id
|
891
|
+
# @param [Hash] opts
|
892
|
+
# @option opts [int] limit
|
893
|
+
# @option opts [int] offset
|
894
|
+
# @option opts [int(list)] status_id
|
895
|
+
# @example Endpoint Example
|
896
|
+
# GET index.php?/api/v2/get_results_for_case/1/2
|
897
|
+
# @example Code
|
898
|
+
# client.get_results_for_case(1, 2, {"status_id": 4, "limit": 10})
|
899
|
+
# @example Request
|
900
|
+
# {"status_id": 4, "limit": 10}
|
901
|
+
# @example Return
|
902
|
+
# see get_results
|
903
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
904
|
+
def get_results_for_case(run_id, case_id, opts = {})
|
905
|
+
options = param_stringify(opts)
|
906
|
+
send_get("get_results_for_case/#{run_id.to_s}/#{case_id.to_s}&#{options}")
|
907
|
+
end
|
908
|
+
|
909
|
+
####get_results_for_run#####
|
910
|
+
# Returns a list of test results for a test run
|
911
|
+
# @param [int] run_id
|
912
|
+
# @param [Hash] opts
|
913
|
+
# @option opts [timestamp] created_after
|
914
|
+
# @option opts [timestamp] created_before
|
915
|
+
# @option opts [int(list)] created_by
|
916
|
+
# @option opts [int] limit
|
917
|
+
# @option opts [int] offset
|
918
|
+
# @option opts [int(list)] status_id
|
919
|
+
# @example Endpoint Example
|
920
|
+
# GET index.php?/api/v2/get_results_for_run/1
|
921
|
+
# @example Code
|
922
|
+
# client.get_results_for_run(1, {"created_after": 12345, "created_before": 12345, "created_by": 1, "limit": 5, "status_id": 1})
|
923
|
+
# @example Request
|
924
|
+
# {"created_after": 12345, "created_before": 12345, "created_by": 1, "limit": 5, "status_id": 1}
|
925
|
+
# @example Return
|
926
|
+
# see get_results
|
927
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
928
|
+
def get_results_for_run(run_id, opts = {})
|
929
|
+
options = param_stringify(opts)
|
930
|
+
send_get("get_results_for_run/#{run_id.to_s}&#{options}")
|
931
|
+
end
|
932
|
+
|
933
|
+
####add_result##############
|
934
|
+
# Adds a new test result, comment or assigns a test. It's recommended to use add_results instead if you plan to add results for multiple tests.
|
935
|
+
# @param [int] test_id
|
936
|
+
# @param [Hash] opts
|
937
|
+
# @option opts [int] status_id
|
938
|
+
# @option opts [string] comment
|
939
|
+
# @option opts [string] version
|
940
|
+
# @option opts [timespan] elapsed
|
941
|
+
# @option opts [string] defects
|
942
|
+
# @option opts [int] assignedto_id
|
943
|
+
# @option opts [bool] custom_checkbox
|
944
|
+
# @option opts [string] custom_dropdown
|
945
|
+
# @option opts [int] custom_integer
|
946
|
+
# @option opts [int] custom_milestone
|
947
|
+
# @option opts [int] custom_multi-select
|
948
|
+
# @option opts [array] custom_step_results
|
949
|
+
# @option opts [array] custom_string
|
950
|
+
# @option opts [string] custom_text
|
951
|
+
# @option opts [string] custom_url
|
952
|
+
# @option opts [string] custom_user
|
953
|
+
# @example Endpoint Example
|
954
|
+
# POST index.php?/api/v2/add_result/1
|
955
|
+
# @example Code
|
956
|
+
# options = json
|
957
|
+
# client.add_result(1, options)
|
958
|
+
# @example Request
|
959
|
+
# {
|
960
|
+
# "status_id": 5,
|
961
|
+
# "comment": "This test failed",
|
962
|
+
# "elapsed": "15s",
|
963
|
+
# "defects": "TR-7",
|
964
|
+
# "version": "1.0 RC1 build 3724",
|
965
|
+
# "custom_step_results": [
|
966
|
+
# {
|
967
|
+
# "content": "Step 1",
|
968
|
+
# "expected": "Expected Result 1",
|
969
|
+
# "actual": "Actual Result 1",
|
970
|
+
# "status_id": 1
|
971
|
+
# },
|
972
|
+
# {
|
973
|
+
# "content": "Step 2",
|
974
|
+
# "expected": "Expected Result 2",
|
975
|
+
# "actual": "Actual Result 2",
|
976
|
+
# "status_id": 2
|
977
|
+
# },
|
978
|
+
# ]
|
979
|
+
# }
|
980
|
+
# @example Return
|
981
|
+
# see get_results
|
982
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
983
|
+
def add_result(test_id, opts = {})
|
984
|
+
send_post("add_result/#{test_id.to_s}", opts)
|
985
|
+
end
|
986
|
+
|
987
|
+
####add_result_for_case#####
|
988
|
+
# Adds a new test result, comment or assigns a test (for a test run and case combination)
|
989
|
+
# @param [int] run_id
|
990
|
+
# @param [int] case_id
|
991
|
+
# @param [Hash] opts see add_result for options
|
992
|
+
# @example Endpoint Example
|
993
|
+
# POST index.php?/api/v2/add_result_for_case/1/1
|
994
|
+
# @example Code
|
995
|
+
# options = json
|
996
|
+
# client.add_result(1, 1, options)
|
997
|
+
# @example Request
|
998
|
+
# {
|
999
|
+
# "status_id": 5,
|
1000
|
+
# "comment": "This test failed",
|
1001
|
+
# "elapsed": "15s",
|
1002
|
+
# "defects": "TR-7",
|
1003
|
+
# "version": "1.0 RC1 build 3724",
|
1004
|
+
# "custom_step_results": [
|
1005
|
+
# {
|
1006
|
+
# "content": "Step 1",
|
1007
|
+
# "expected": "Expected Result 1",
|
1008
|
+
# "actual": "Actual Result 1",
|
1009
|
+
# "status_id": 1
|
1010
|
+
# },
|
1011
|
+
# {
|
1012
|
+
# "content": "Step 2",
|
1013
|
+
# "expected": "Expected Result 2",
|
1014
|
+
# "actual": "Actual Result 2",
|
1015
|
+
# "status_id": 2
|
1016
|
+
# },
|
1017
|
+
# ]
|
1018
|
+
# }
|
1019
|
+
# @example Return
|
1020
|
+
# see get_results
|
1021
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
1022
|
+
def add_result_for_case(run_id, case_id, opts = {})
|
1023
|
+
send_post("add_result_for_case/#{run_id.to_s}/#{case_id.to_s}", opts)
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
####add_results#############
|
1027
|
+
# Adds one or more new test results, comments or assigns one or more tests
|
1028
|
+
# @param run_id [int]
|
1029
|
+
# @param [Hash] opts
|
1030
|
+
# @option [varies] see add_result
|
1031
|
+
# @example Endpoint Example
|
1032
|
+
# index.php?/api/v2/add_results/1
|
1033
|
+
# @example Code
|
1034
|
+
# opts = json
|
1035
|
+
# client.add_results(1, opts)
|
1036
|
+
# @example Request
|
1037
|
+
# {
|
1038
|
+
# "results": [
|
1039
|
+
# {
|
1040
|
+
# "test_id": 101,
|
1041
|
+
# "status_id": 5,
|
1042
|
+
# "comment": "This test failed",
|
1043
|
+
# "defects": "TR-7"
|
1044
|
+
|
1045
|
+
# },
|
1046
|
+
# {
|
1047
|
+
# "test_id": 102,
|
1048
|
+
# "status_id": 1,
|
1049
|
+
# "comment": "This test passed",
|
1050
|
+
# "elapsed": "5m",
|
1051
|
+
# "version": "1.0 RC1"
|
1052
|
+
# },
|
1053
|
+
|
1054
|
+
# ..
|
1055
|
+
|
1056
|
+
# {
|
1057
|
+
# "test_id": 101,
|
1058
|
+
# "assignedto_id": 5,
|
1059
|
+
# "comment": "Assigned this test to Joe"
|
1060
|
+
# }
|
1061
|
+
|
1062
|
+
# ..
|
1063
|
+
# ]
|
1064
|
+
# }
|
1065
|
+
# @example Return
|
1066
|
+
# see get_results
|
1067
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
1068
|
+
def add_results(run_id, opts = {})
|
1069
|
+
send_post("add_results/#{run_id.to_s}", opts)
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
####add_results_for_cases###
|
1073
|
+
# Adds one or more new test results, comments or assigns one or more tests (using the case IDs)
|
1074
|
+
# @param [int] run_id
|
1075
|
+
# @param [Hash] opts
|
1076
|
+
# @option [varies] see add_result
|
1077
|
+
# @example Endpoint Example
|
1078
|
+
# index.php?/api/v2/add_results_for_cases/1
|
1079
|
+
# @example Code
|
1080
|
+
# opts =
|
1081
|
+
# client.add_results_for_cases(1, opts)
|
1082
|
+
# @example Request
|
1083
|
+
# Expects case_id instead of test_id
|
1084
|
+
# {
|
1085
|
+
# "results": [
|
1086
|
+
# {
|
1087
|
+
# "case_id": 1,
|
1088
|
+
# "status_id": 5,
|
1089
|
+
# "comment": "This test failed",
|
1090
|
+
# "defects": "TR-7"
|
1091
|
+
# },
|
1092
|
+
# {
|
1093
|
+
# "case_id": 2,
|
1094
|
+
# "status_id": 1,
|
1095
|
+
# "comment": "This test passed",
|
1096
|
+
# "elapsed": "5m",
|
1097
|
+
# "version": "1.0 RC1"
|
1098
|
+
# },
|
1099
|
+
# {
|
1100
|
+
# "case_id": 1,
|
1101
|
+
# "assignedto_id": 5,
|
1102
|
+
# "comment": "Assigned this test to Joe"
|
1103
|
+
# }
|
1104
|
+
# ]
|
1105
|
+
# }
|
1106
|
+
# @example Return
|
1107
|
+
# see get_results
|
1108
|
+
# @see http://docs.gurock.com/testrail-api2/reference-results
|
1109
|
+
def add_results_for_cases(run_id, opts = {})
|
1110
|
+
send_post("add_results_for_cases/#{run_id.to_s}", opts)
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
#### RUNS ###############++++++6
|
1114
|
+
|
1115
|
+
####get_run#################
|
1116
|
+
# Get run by run id
|
1117
|
+
# @param [int] run_id
|
1118
|
+
# @example Endpoint Example
|
1119
|
+
# GET index.php?/api/v2/get_run/1
|
1120
|
+
# @example Code
|
1121
|
+
# client.get_run(1)
|
1122
|
+
# @example Return
|
1123
|
+
# {
|
1124
|
+
# "assignedto_id": 6,
|
1125
|
+
# "blocked_count": 0,
|
1126
|
+
# "completed_on": null,
|
1127
|
+
# "config": "Firefox, Ubuntu 12",
|
1128
|
+
# "config_ids": [
|
1129
|
+
# 2,
|
1130
|
+
# 6
|
1131
|
+
# ],
|
1132
|
+
# "created_by": 1,
|
1133
|
+
# "created_on": 1393845644,
|
1134
|
+
# "custom_status1_count": 0,
|
1135
|
+
# "custom_status2_count": 0,
|
1136
|
+
# "custom_status3_count": 0,
|
1137
|
+
# "custom_status4_count": 0,
|
1138
|
+
# "custom_status5_count": 0,
|
1139
|
+
# "custom_status6_count": 0,
|
1140
|
+
# "custom_status7_count": 0,
|
1141
|
+
# "description": null,
|
1142
|
+
# "failed_count": 2,
|
1143
|
+
# "id": 81,
|
1144
|
+
# "include_all": false,
|
1145
|
+
# "is_completed": false,
|
1146
|
+
# "milestone_id": 7,
|
1147
|
+
# "name": "File Formats",
|
1148
|
+
# "passed_count": 2,
|
1149
|
+
# "plan_id": 80,
|
1150
|
+
# "project_id": 1,
|
1151
|
+
# "retest_count": 1,
|
1152
|
+
# "suite_id": 4,
|
1153
|
+
# "untested_count": 3,
|
1154
|
+
# "url": "http://<server>/testrail/index.php?/runs/view/81"
|
1155
|
+
# }
|
1156
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1157
|
+
def get_run(run_id)
|
1158
|
+
send_get("get_run/#{run_id.to_s}")
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
####get_runs################
|
1162
|
+
# Get runs by project id
|
1163
|
+
# @param [int] run_id
|
1164
|
+
# @param [hash] opts
|
1165
|
+
# @option [timestamp] created_after
|
1166
|
+
# @option [timestamp] created_before
|
1167
|
+
# @option [int(list)] created_by
|
1168
|
+
# @option [bool] is_completed
|
1169
|
+
# @option [int] limit
|
1170
|
+
# @option [int] offset
|
1171
|
+
# @option [int(list)] milestone_id
|
1172
|
+
# @option [int(list)] suite_id
|
1173
|
+
# @example Endpoint Example
|
1174
|
+
# index.php?/api/v2/get_runs/1
|
1175
|
+
# @example Code
|
1176
|
+
# opts = json
|
1177
|
+
# client.get_runs(1, opts)
|
1178
|
+
# @example Return
|
1179
|
+
# {
|
1180
|
+
# "assignedto_id": 6,
|
1181
|
+
# "blocked_count": 0,
|
1182
|
+
# "completed_on": null,
|
1183
|
+
# "config": "Firefox, Ubuntu 12",
|
1184
|
+
# "config_ids": [
|
1185
|
+
# 2,
|
1186
|
+
# 6
|
1187
|
+
# ],
|
1188
|
+
# "created_by": 1,
|
1189
|
+
# "created_on": 1393845644,
|
1190
|
+
# "custom_status1_count": 0,
|
1191
|
+
# "custom_status2_count": 0,
|
1192
|
+
# "custom_status3_count": 0,
|
1193
|
+
# "custom_status4_count": 0,
|
1194
|
+
# "custom_status5_count": 0,
|
1195
|
+
# "custom_status6_count": 0,
|
1196
|
+
# "custom_status7_count": 0,
|
1197
|
+
# "description": null,
|
1198
|
+
# "failed_count": 2,
|
1199
|
+
# "id": 81,
|
1200
|
+
# "include_all": false,
|
1201
|
+
# "is_completed": false,
|
1202
|
+
# "milestone_id": 7,
|
1203
|
+
# "name": "File Formats",
|
1204
|
+
# "passed_count": 2,
|
1205
|
+
# "plan_id": 80,
|
1206
|
+
# "project_id": 1,
|
1207
|
+
# "retest_count": 1,
|
1208
|
+
# "suite_id": 4,
|
1209
|
+
# "untested_count": 3,
|
1210
|
+
# "url": "http://<server>/testrail/index.php?/runs/view/81"
|
1211
|
+
# }
|
1212
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1213
|
+
def get_runs(project_id, opts = {})
|
1214
|
+
options = param_stringify(opts)
|
1215
|
+
send_get("get_runs/#{project_id.to_s}&#{options}")
|
1216
|
+
end
|
1217
|
+
|
1218
|
+
####add_run#################
|
1219
|
+
# Add run by suite id
|
1220
|
+
# @param [int] project_id
|
1221
|
+
# @param [Hash] opts
|
1222
|
+
# @option [int] suite_id
|
1223
|
+
# @option [string] name
|
1224
|
+
# @option [string] description
|
1225
|
+
# @option [int] milestone_id
|
1226
|
+
# @option [int] assignedto_id
|
1227
|
+
# @option [bool] include_all
|
1228
|
+
# @option [array] case_ids
|
1229
|
+
# @example Endpoint Example
|
1230
|
+
# POST index.php?/api/v2/add_run/1
|
1231
|
+
# @example Code
|
1232
|
+
# opts = json
|
1233
|
+
# client.add_run(1, opts)
|
1234
|
+
# @example Request
|
1235
|
+
# {
|
1236
|
+
# "suite_id": 1,
|
1237
|
+
# "name": "This is a new test run",
|
1238
|
+
# "assignedto_id": 5,
|
1239
|
+
# "include_all": false,
|
1240
|
+
# "case_ids": [1, 2, 3, 4, 7, 8]
|
1241
|
+
# }
|
1242
|
+
# @example Return
|
1243
|
+
# see get_run
|
1244
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1245
|
+
def add_run(project_id, opts = {})
|
1246
|
+
send_post("add_run/#{project_id.to_s}", opts)
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
####update_run##############
|
1250
|
+
# Updates existing test run
|
1251
|
+
# @param run_id [int]
|
1252
|
+
# @param [Hash] opts
|
1253
|
+
# @option [string] name
|
1254
|
+
# @option [string] description
|
1255
|
+
# @option [int] milestone_id
|
1256
|
+
# @option [bool] include_all
|
1257
|
+
# @option [array] case_ids
|
1258
|
+
# @example Endpoint Example
|
1259
|
+
# POST index.php?/api/v2/update_run/1
|
1260
|
+
# @example Code
|
1261
|
+
# opts = json
|
1262
|
+
# client.update_run(1, opts)
|
1263
|
+
# @example Request
|
1264
|
+
# {
|
1265
|
+
# "name": "This is a test run",
|
1266
|
+
# "include_all": false
|
1267
|
+
# }
|
1268
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1269
|
+
def update_run(run_id, opts = {})
|
1270
|
+
send_post("update_run/#{run_id.to_s}", opts)
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
####close_run###############
|
1274
|
+
# Closes an existing test run and archives its tests & results
|
1275
|
+
# @param [int] run_id
|
1276
|
+
# @example Endpoint Example
|
1277
|
+
# POST index.php?/api/v2/close_run/1
|
1278
|
+
# @example Code
|
1279
|
+
# client.close_run(1)
|
1280
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1281
|
+
def close_run(run_id, opts = {})
|
1282
|
+
send_post("close_run/#{run_id.to_s}", opts)
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
####delete_run##############
|
1286
|
+
# Deletes an existing test run.
|
1287
|
+
# @param run_id [int]
|
1288
|
+
# @example Endpoint Example
|
1289
|
+
# POST index.php?/api/v2/delete_run/1
|
1290
|
+
# @example Code
|
1291
|
+
# client.delete_run(1)
|
1292
|
+
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
1293
|
+
def delete_run(run_id, opts = {})
|
1294
|
+
send_post("delete_run/#{run_id.to_s}", opts)
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
#### TESTS ##################++2
|
1298
|
+
|
1299
|
+
####get_test################
|
1300
|
+
# Returns an existing test
|
1301
|
+
# @param test_id [int]
|
1302
|
+
# @example Endpoint Example
|
1303
|
+
# GET index.php?/api/v2/get_test/1
|
1304
|
+
# @example Code
|
1305
|
+
# client.get_test(1)
|
1306
|
+
# @example Return
|
1307
|
+
# {
|
1308
|
+
# "assignedto_id": 1,
|
1309
|
+
# "case_id": 1,
|
1310
|
+
# "custom_expected": "..",
|
1311
|
+
# "custom_preconds": "..",
|
1312
|
+
# "custom_steps_separated": [
|
1313
|
+
# {
|
1314
|
+
# "content": "Step 1",
|
1315
|
+
# "expected": "Expected Result 1"
|
1316
|
+
# },
|
1317
|
+
# {
|
1318
|
+
# "content": "Step 2",
|
1319
|
+
# "expected": "Expected Result 2"
|
1320
|
+
# }
|
1321
|
+
# ],
|
1322
|
+
# "estimate": "1m 5s",
|
1323
|
+
# "estimate_forecast": null,
|
1324
|
+
# "id": 100,
|
1325
|
+
# "priority_id": 2,
|
1326
|
+
# "run_id": 1,
|
1327
|
+
# "status_id": 5,
|
1328
|
+
# "title": "Verify line spacing on multi-page document",
|
1329
|
+
# "type_id": 4
|
1330
|
+
# }
|
1331
|
+
# @see http://docs.gurock.com/testrail-api2/reference-tests
|
1332
|
+
def get_test(test_id)
|
1333
|
+
send_get("get_test/#{test_id.to_s}")
|
1334
|
+
end
|
1335
|
+
|
1336
|
+
####get_tests###############
|
1337
|
+
# Returns an existing test
|
1338
|
+
# @param run_id [int]
|
1339
|
+
# @param opts [hash]
|
1340
|
+
# @option [int(list)] status_id
|
1341
|
+
# @example Endpoint Example
|
1342
|
+
# GET index.php?/api/v2/get_tests/1
|
1343
|
+
# @example Code
|
1344
|
+
# client.get_tests(1, {"status_id": 1})
|
1345
|
+
# @example Return
|
1346
|
+
# [
|
1347
|
+
# {
|
1348
|
+
# "id": 1,
|
1349
|
+
# "title": "Test conditional formatting with basic value range",
|
1350
|
+
# },
|
1351
|
+
# {
|
1352
|
+
# "id": 2,
|
1353
|
+
# "title": "Verify line spacing on multi-page document",
|
1354
|
+
# },
|
1355
|
+
# ]
|
1356
|
+
# @see http://docs.gurock.com/testrail-api2/reference-tests
|
1357
|
+
def get_tests(run_id, opts = {})
|
1358
|
+
options = param_stringify(opts)
|
1359
|
+
send_get("get_tests/#{run_id.to_s}&#{options}")
|
1360
|
+
end
|
1361
|
+
|
699
1362
|
|
700
1363
|
end #close module
|