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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7387cf9917e3b69f6a5547bce30d099443778c0
4
- data.tar.gz: 688ed741faa8d4ccb30132169cc0e503bbe7ac77
3
+ metadata.gz: 3c42e4af387515e94b82360326dbafde088d09bc
4
+ data.tar.gz: fe2e2bf41e5bdd0b760add1090a0e8cc6d12fd3a
5
5
  SHA512:
6
- metadata.gz: 8cebd0c92601e9ca7816f6796c25bbd422b858fd855dfb28b6fbc47c87a197ccfb1119678851f58b3b0c8a528e9bcd17dda4737ad1a84c0ac7b7febd07730757
7
- data.tar.gz: 0b9005153e3c8d851aa2a55b645c38d7a54bb3509d7e46edf5cbdbcd0fcb7386ce33cde1b1a85d25cad45689163beac1dfbe9e6bd8591a6c35be91d06320b2a5
6
+ metadata.gz: 17c54a2f5e5d77b66959c80c355b7e529c435d2f1ea431f8ad32aa37aa456999a6410a5cba1c2607fd734ad6962be4ff1443ffbfcadd3a60044f2bf86d84a103
7
+ data.tar.gz: 45065c57e2f57f667b6f632032fa10d2e614aab8f18418335b2b86131ac5f0992a1a1b3ce81e74359a869d4e5d157a587d203d2b80c8e3d86b4aef5d0c085b52
@@ -1,700 +1,1363 @@
1
1
  module Endpoints
2
- ##########################++
3
- ####get_case################
4
- ############################
5
- # Returns an existing test case
6
- # @param case_id [int] The id of the test case you want.
7
- # @example Code Example
8
- # @client.get_case(1)
9
- # @example Endpoint Example
10
- # GET index.php?/api/v2/get_case/1
11
- # @example Response Example
12
- # {
13
- # "created_by": 5,s
14
- # "created_on": 1392300984,
15
- # "custom_expected": "..",
16
- # "custom_preconds": "..",
17
- # "custom_steps": "..",
18
- # "custom_steps_separated": [
19
- # {
20
- # "content": "Step 1",
21
- # "expected": "Expected Result 1"
22
- # },
23
- # {
24
- # "content": "Step 2",
25
- # "expected": "Expected Result 2"
26
- # }
27
- # ],
28
- # "estimate": "1m 5s",
29
- # "estimate_forecast": null,
30
- # "id": 1,
31
- # "milestone_id": 7,
32
- # "priority_id": 2,
33
- # "refs": "RF-1, RF-2",
34
- # "section_id": 1,
35
- # "suite_id": 1,
36
- # "title": "Change document attributes (author, title, organization)",
37
- # "type_id": 4,
38
- # "updated_by": 1,
39
- # "updated_on": 1393586511
40
- # }
41
- # @see http://docs.gurock.com/testrail-api2/reference-cases
42
- def get_case(case_id)
43
- send_get("get_case/#{case_id}")
44
- end
45
-
46
- ##########################++
47
- ####get_cases###############
48
- ############################
49
- # Returns a list of test cases for a test suite or specific section in a test suite.
50
- # @param project_id [int] The id of the project that contains your tests
51
- # @param [Hash] opts
52
- # @option opts [int] :suite_id The ID of the test suite (optional if the project is operating in single suite mode)
53
- # @option opts [int] :section_id The ID of the section (optional)
54
- # @option opts [unix timestamp] :created_after Only return test cases created after this date (as UNIX timestamp).
55
- # @option opts [unix timestamp] :created_before Only return test cases created before this date (as UNIX timestamp).
56
- # @option opts [int(list)] :created_by A comma-separated list of creators (user IDs) to filter by.
57
- # @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).
58
- # @option opts [int(list)] :priority_id A comma-separated list of priority IDs to filter by.
59
- # @option opts [int(list)] :template_id A comma-separated list of template IDs to filter by (requires TestRail 5.2 or later)
60
- # @option opts [int(list)] :type_id A comma-separated list of case type IDs to filter by.
61
- # @option opts [unix timestamp] :updated_after Only return test cases updated after this date (as UNIX timestamp).
62
- # @option opts [unix timestamp] :updated_before Only return test cases updated before this date (as UNIX timestamp).
63
- # @option opts [int(list)] :updated_by A comma-separated list of users who updated test cases to filter by.
64
- # @example Code Example
65
- # @client.get_cases(1, {"suite_id":1, "section_id":1})
66
- # @example Endpoint Example
67
- # GET index.php?/api/v2/get_cases/1&suite_id=1&section_id=1
68
- # @example Response Example
69
- # [
70
- # { "id": 1, "title": "..", .. },
71
- # { "id": 2, "title": "..", .. },
72
- # ..
73
- # ]
74
- # @see http://docs.gurock.com/testrail-api2/reference-cases
75
- def get_cases(project_id, opts = {})
76
- options = param_stringify(opts)
77
- send_get("get_cases/#{project_id.to_s}&#{options}")
78
- end
79
-
80
- ############################
81
- ####add_case################
82
- ############################
83
- # Creates a new test case
84
- # @param section_id [int] The ID of the section the test case should be added to
85
- # @param [Hash] opts
86
- # @option opts [string] :title The title of the test case (required)
87
- # @option opts [int] :template_id The ID of the template (field layout) (requires TestRail 5.2 or later)
88
- # @option opts [int] :type_id The ID of the case type
89
- # @option opts [int] :priority_id The ID of the case priority
90
- # @option opts [timespan] :estimate The estimate, e.g. "30s" or "1m 45s"
91
- # @option opts [int] :milestone_id The ID of the milestone to link to the test case
92
- # @option opts [string] :refs A comma-separated list of references/requirements
93
- # @option opts [varies] :custom_fields Custom fields are supported as well and must be submitted with their system name, prefixed with 'custom_'
94
- # @example Code Example
95
- # @client.add_case(1, {"title":"testCaseName", "type_id":1})
96
- # @example Endpoint Example
97
- # index.php?/api/v2/add_case/1&title="foo"&type_id=1
98
- # @see http://docs.gurock.com/testrail-api2/reference-cases
99
- # @note For more information about custom fields, see guroc docs
100
- def add_case(section_id, opts = {})
101
- send_post("add_case/#{section_id.to_s}", opts)
102
- end
103
-
104
- ############################
105
- ####update_case#############
106
- ############################
107
- # Update test result by case id
108
- # @param case_id [int] The id of the test case
109
- # @param [Hash] opts
110
- # @example Endpoint Example
111
- # index.php?/api/v2/update_case/:case_id
112
- # @see http://docs.gurock.com/testrail-api2/reference-cases
113
- def update_case(case_id, opts = {})
114
- send_post("update_case/#{case_id.to_s}", opts)
115
- end
116
-
117
- ############################
118
- ####delete_case#############
119
- ############################
120
- # Delete test case by case id
121
- # @param case_id [int] The id of the test case
122
- # @param [Hash] opts
123
- # @example Endpoint Example
124
- # index.php?/api/v2/delete_case/:case_id
125
- # @see http://docs.gurock.com/testrail-api2/reference-cases
126
- def delete_case(case_id, opts = {})
127
- send_post("delete_case/#{case_id.to_s}", opts)
128
- end
129
-
130
- ##########################++
131
- ####get_suite###############
132
- ############################
133
- # Return suite by suite id
134
- # @param suite_id [int] The suite id
135
- # @param [Hash] opts
136
- # @example Endpoint Example
137
- # index.php?/api/v2/get_suite/:suite_id
138
- # @see http://docs.gurock.com/testrail-api2/reference-suites
139
- def get_suite(suite_id)
140
- send_get("get_suite/#{suite_id.to_s}")
141
- end
142
-
143
- ##########################++
144
- ####get_suites##############
145
- ############################
146
- # Return all suites in project by project id
147
- # @param project_id (see get_cases)
148
- # @param [Hash] opts
149
- # @example Endpoint Example
150
- # index.php?/api/v2/get_suites/:project_id
151
- # @see http://docs.gurock.com/testrail-api2/reference-suites
152
- def get_suites(project_id)
153
- send_get("get_suites/#{project_id.to_s}")
154
- end
155
-
156
- ############################
157
- ####add_suite###############
158
- ############################
159
- # Add a test suite
160
- # @param project_id [int] The id of the project containing suites
161
- # @param [Hash] opts
162
- # @example Endpoint Example
163
- # index.php?/api/v2/add_suite/:project_id
164
- # @see http://docs.gurock.com/testrail-api2/reference-suites
165
- def add_suite(project_id, opts = {})
166
- send_post("add_suite/#{project_id.to_s}", opts)
167
- end
168
-
169
- ############################
170
- ####update_suite############
171
- ############################
172
- # update a test suite
173
- # @param suite_id [int] The suite id
174
- # @param [Hash] opts
175
- # @example Endpoint Example
176
- # index.php?/api/v2/update_suite/:suite_id
177
- # @see http://docs.gurock.com/testrail-api2/reference-suites
178
- def update_suite(suite_id, opts = {})
179
- send_post("update_suite/#{suite_id.to_s}", opts)
180
- end
181
-
182
- ############################
183
- ####delete_suite############
184
- ############################
185
- # Delete a test suite
186
- # @param suite_id [int] The suite id
187
- # @param [Hash] opts
188
- # @example Endpoint Example
189
- # index.php?/api/v2/delete_suite/:suite_id
190
- # @see http://docs.gurock.com/testrail-api2/reference-suites
191
- def delete_suite(suite_id, opts = {})
192
- send_post("delete_suite/#{suite_id.to_s}", opts)
193
- end
194
-
195
-
196
- ##########################++
197
- ####get_section#############
198
- ############################
199
- # Return section by id
200
- # @param section_id [int]
201
- # @param [Hash] opts
202
- # @example Endpoint Example
203
- # index.php?/api/v2/get_section/:section_id
204
- # @see http://docs.gurock.com/testrail-api2/reference-sections
205
- def get_section(section_id)
206
- send_get("get_section/#{section_id.to_s}")
207
- end
208
-
209
- ##########################++
210
- ####get_sections############
211
- ############################
212
- # Get sections for suite
213
- # @param project_id [int]
214
- # @param [Hash] opts
215
- # @options opts [int] :suite_id
216
- # @example Endpoint Example
217
- # index.php?/api/v2/get_sections/1&suite_id=2
218
- # @example Code Example
219
- # client.get_sections(1, {"suite_id":2})
220
- # @see http://docs.gurock.com/testrail-api2/reference-sections
221
- def get_sections(project_id, opts = {})
222
- options = param_stringify(opts)
223
- send_get("get_sections/#{project_id.to_s}&#{options}")
224
- end
225
-
226
- ############################
227
- ####add_section#############
228
- ############################
229
- # Add section to suite
230
- # @param project_id [int]
231
- # @param [Hash] opts
232
- # @option opts [Int] suite_id
233
- # @option opts [String] name
234
- # @option opts [Int] parent_id
235
- # @example Endpoint Example
236
- # index.php?/api/v2/add_section/:project_id
237
- # @example Code Example
238
- # @client.add_section(1, {"suite_id": 5, "name": "This is a new section", "parent_id": 10})
239
- # @see http://docs.gurock.com/testrail-api2/reference-sections
240
- def add_section(project_id, opts = {})
241
- send_post("add_section/#{project_id.to_s}", opts)
242
- end
243
-
244
- ############################
245
- ####get_milestone###########
246
- ############################
247
- # Get milestone by milestone id
248
- # @param milestone_id [int]
249
- # @param [Hash] opts
250
- # @example Endpoint Example
251
- # index.php?/api/v2/get_milestone/:milestone_id
252
- # @see http://docs.gurock.com/testrail-api2/reference-milestones
253
- def get_milestone(milestone_id, opts = {})
254
- send_get("get_milestone/#{milestone_id.to_s}", opts)
255
- end
256
-
257
- ############################
258
- ####get_milestones##########
259
- ############################
260
- # Get project milestones by project id
261
- # @param project_id [int]
262
- # @param [Hash] opts
263
- # @example Endpoint Example
264
- # index.php?/api/v2/get_milestones/:project_id
265
- # @see http://docs.gurock.com/testrail-api2/reference-milestones
266
- def get_milestones(project_id, opts = {})
267
- send_get("get_milestones/#{project_id.to_s}", opts)
268
- end
269
-
270
- ############################
271
- ####add_milestone###########
272
- ############################
273
- # Add milestone to project id
274
- # @param project_id [int]
275
- # @param [Hash] opts
276
- # @example Endpoint Example
277
- # index.php?/api/v2/add_milestone/:project_id
278
- # @see http://docs.gurock.com/testrail-api2/reference-milestones
279
- def add_milestone(project_id, opts = {})
280
- send_post("add_milestone/#{project_id.to_s}", opts)
281
- end
282
-
283
- ############################
284
- ####update_milestone########
285
- ############################
286
- # Add milestone to project id
287
- # @param milestone_id [int]
288
- # @param [Hash] opts
289
- # @example Endpoint Example
290
- # index.php?/api/v2/update_milestone/:milestone_id
291
- # @see http://docs.gurock.com/testrail-api2/reference-milestones
292
- def update_milestone(milestone_id, opts = {})
293
- send_post("update_milestone/#{milestone_id.to_s}", opts)
294
- end
295
-
296
- ############################
297
- ####delete_milestone########
298
- ############################
299
- # Add milestone to project id
300
- # @param milestone_id [int]
301
- # @param [Hash] opts
302
- # @example Endpoint Example
303
- # index.php?/api/v2/delete_milestone/:milestone_id
304
- # @see http://docs.gurock.com/testrail-api2/reference-milestones
305
- def delete_milestone(milestone_id, opts = {})
306
- send_post("delete_milestone/#{milestone_id.to_s}", opts)
307
- end
308
-
309
- ##########################++
310
- ####get_plan################
311
- ############################
312
- # Get plan by id
313
- # @param plan_id [int]
314
- # @param [Hash] opts
315
- # @example Endpoint Example
316
- # index.php?/api/v2/get_plan/:plan_id
317
- # @see http://docs.gurock.com/testrail-api2/reference-plans
318
- def get_plan(plan_id)
319
- send_get("get_plan/#{plan_id.to_s}")
320
- end
321
-
322
- ##########################++
323
- ####get_plans###############
324
- ############################
325
- # Get plans in project by project id
326
- # @param project_id [int]
327
- # @param [Hash] opts
328
- # @example Endpoint Example
329
- # index.php?/api/v2/get_plans/:project_id
330
- # @see http://docs.gurock.com/testrail-api2/reference-plans
331
- def get_plans(project_id)
332
- send_get("get_plans/#{project_id.to_s}")
333
- end
334
-
335
- ############################
336
- ####add_plan################
337
- ############################
338
- # Add plan to project by project id
339
- # @param project_id [int]
340
- # @param [Hash] opts
341
- # @example Endpoint Example
342
- # index.php?/api/v2/add_plan/:project_id
343
- # @see http://docs.gurock.com/testrail-api2/reference-plans
344
- def add_plan(project_id, opts = {})
345
- send_post("add_plan/#{project_id.to_s}", opts)
346
- end
347
-
348
- ############################
349
- ####add_plan_entry##########
350
- ############################
351
- # Add plan entries by plan id
352
- # @param plan_id [int]
353
- # @param [Hash] opts
354
- # @example Endpoint Example
355
- # index.php?/api/v2/add_plan_entry/:plan_id
356
- # @see http://docs.gurock.com/testrail-api2/reference-plans
357
- def add_plan_entry(plan_id, opts = {})
358
- send_post("add_plan_entry/#{plan_id.to_s}", opts)
359
- end
360
-
361
- ############################
362
- ####update_plan#############
363
- ############################
364
- # Update plan by plan id
365
- # @param plan_id [int]
366
- # @param [Hash] opts
367
- # @example Endpoint Example
368
- # index.php?/api/v2/update_plan/:plan_id
369
- # @see http://docs.gurock.com/testrail-api2/reference-plans
370
- def update_plan(plan_id, opts = {})
371
- send_post("update_plan/#{plan_id.to_s}", opts)
372
- end
373
-
374
- ############################
375
- ####update_plan_entry#######
376
- ############################
377
- # Update plan entry by plan id
378
- # @param plan_id [int]
379
- # @param entry_id [int] Id of entry
380
- # @param [Hash] opts
381
- # @example Endpoint Example
382
- # index.php?/api/v2/update_plan_entry/:plan_id/:entry_id
383
- # @see http://docs.gurock.com/testrail-api2/reference-plans
384
- def update_plan_entry(plan_id, entry_id, opts = {})
385
- send_post("update_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
386
- end
387
-
388
- ############################
389
- ####close_plan##############
390
- ############################
391
- # Close plan by plan id
392
- # @param plan_id [int]
393
- # @param [Hash] opts
394
- # @example Endpoint Example
395
- # index.php?/api/v2/close_plan/:plan_id
396
- # @see http://docs.gurock.com/testrail-api2/reference-plans
397
- def close_plan(plan_id, opts = {})
398
- send_post("close_plan/#{plan_id.to_s}", opts)
399
- end
400
-
401
- ############################
402
- ####delete_plan#############
403
- ############################
404
- # @example Endpoint Example
405
- # index.php?/api/v2/delete_plan/:plan_id
406
- # @see http://docs.gurock.com/testrail-api2/reference-plans
407
- def delete_plan(plan_id, opts)
408
- send_post("delete_plan/#{plan_id.to_s}", opts)
409
- end
410
-
411
- ############################
412
- ####delete_plan_by_entry####
413
- ############################
414
- # @example Endpoint Example
415
- # index.php?/api/v2/delete_plan_entry/:plan_id/:entry_id
416
- def delete_plan_entry(plan_id, entry_id, opts = {})
417
- send_post("delete_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
418
- end
419
-
420
- ##########################++
421
- ####get_project#############
422
- ############################
423
- # Get project by project id
424
- # @param project_id [int]
425
- # @param [Hash] opts
426
- # @example Endpoint Example
427
- # index.php?/api/v2/get_project/:project_id
428
- # @see http://docs.gurock.com/testrail-api2/reference-projects
429
- def get_project(project_id, opts = {})
430
- options = param_stringify(opts)
431
- send_get("get_project/#{project_id.to_s}&#{options}")
432
- end
433
-
434
- ##########################++
435
- ####get_projects############
436
- ############################
437
- # Get all projects
438
- # @param [Hash] opts
439
- # @option opts [bool] :is_completed 1 == completed projects, 2 == active projects
440
- # @example Endpoint Example
441
- # index.php?/api/v2/get_projects
442
- # @example Code Example [get all projects]
443
- # client.get_projects
444
- # @example Code Example [get active projects]
445
- # client.get_projects({'is_completed':0})
446
- # @example Code Example [get completed projects]
447
- # client.get_projects({'is_completed':1})
448
- # @example Response Example
449
- # [
450
- # { "id": 1, "name": "Project1", ... },
451
- # { "id": 2, "name": "Project2", ... },
452
- # ..
453
- # ]
454
- # @see http://docs.gurock.com/testrail-api2/reference-projects
455
- def get_projects(opts = {})
456
- options = param_stringify(opts)
457
- send_get("get_projects&#{options}")
458
- end
459
-
460
- ############################
461
- ####add_project#############
462
- ############################
463
- # Add a project
464
- # @param [Hash] opts
465
- # @example Endpoint Example
466
- # index.php?/api/v2/add_project
467
- # @see http://docs.gurock.com/testrail-api2/reference-projects
468
- def add_project(opts = {})
469
- send_post("add_project", opts)
470
- end
471
-
472
- ############################
473
- ####update_project##########
474
- ############################
475
- # Update a project
476
- # @param project_id [int] The project you want to update
477
- # @param [Hash] opts
478
- # @example Endpoint Example
479
- # index.php?/api/v2/update_project/:project_id
480
- # @see http://docs.gurock.com/testrail-api2/reference-projects
481
- def update_project(project_id, opts)
482
- send_post("update_project/#{project_id.to_s}", opts)
483
- end
484
-
485
- ############################
486
- ####delete_project##########
487
- ############################
488
- # Delete a project
489
- # @param project_id [int] The project you want to delete
490
- # @param [Hash] opts
491
- # @example Endpoint Example
492
- # index.php?/api/v2/delete_project/:project_id
493
- # @see http://docs.gurock.com/testrail-api2/reference-projects
494
- def delete_project(project_id, opts)
495
- send_post("delete_project/#{project_id.to_s}", opts)
496
- end
497
-
498
- ##########################==
499
- ####get_results#############
500
- ############################
501
- # Returns a list of test results for a test
502
- # @param test_id [int]
503
- # @param [Hash] opts
504
- # @example Endpoint Example
505
- # index.php?/api/v2/get_results/:test_id
506
- # @see http://docs.gurock.com/testrail-api2/reference-results
507
- def get_results(test_id, opts = {})
508
- options = param_stringify(opts)
509
- send_get("get_results/#{test_id.to_s}&#{options}")
510
- end
511
-
512
- ##########################==
513
- ####get_results_for_case####
514
- ############################
515
- # Returns a list of test results for a test run and case combination
516
- # @param run_id [int]
517
- # @param case_id [int]
518
- # @param [Hash] opts
519
- # @example Endpoint Example
520
- # index.php?/api/v2/get_results_for_case/:run_id/:case_id
521
- # @see http://docs.gurock.com/testrail-api2/reference-results
522
- def get_results_for_case(run_id, case_id, opts = {})
523
- options = param_stringify(opts)
524
- send_get("get_results_for_case/#{run_id.to_s}/#{case_id.to_s}&#{options}")
525
- end
526
-
527
- ##########################==
528
- ####get_results_for_run#####
529
- ############################
530
- # Returns a list of test results for a test run
531
- # @param run_id [int]
532
- # @param [Hash] opts
533
- # @example Endpoint Example
534
- # index.php?/api/v2/get_results_for_run/:run_id
535
- # @see http://docs.gurock.com/testrail-api2/reference-results
536
- def get_results_for_run(run_id, opts = {})
537
- options = param_stringify(opts)
538
- send_get("get_results_for_run/#{run_id.to_s}&#{options}")
539
- end
540
-
541
- ############################
542
- ####add_result##############
543
- ############################
544
- # 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.
545
- # @param test_id [int]
546
- # @param [Hash] opts
547
- # @example Endpoint Example
548
- # index.php?/api/v2/add_result/:test_id
549
- # @see http://docs.gurock.com/testrail-api2/reference-results
550
- def add_result(test_id, opts = {})
551
- send_post("add_result/#{test_id.to_s}", opts)
552
- end
553
-
554
- ############################
555
- ####add_result_for_case#####
556
- ############################
557
- # Adds a new test result, comment or assigns a test (for a test run and case combination)
558
- # @param run_id [int]
559
- # @param case_id [int]
560
- # @param [Hash] opts
561
- # @example Endpoint Example
562
- # index.php?/api/v2/add_result_for_case/:run_id/:case_id
563
- # @see http://docs.gurock.com/testrail-api2/reference-results
564
- def add_result_for_case(run_id, case_id, opts = {})
565
- send_post("add_result_for_case/#{run_id.to_s}/#{case_id.to_s}", opts)
566
- end
567
-
568
- ############################
569
- ####add_results#############
570
- ############################
571
- # Adds one or more new test results, comments or assigns one or more tests
572
- # @param run_id [int]
573
- # @param [Hash] opts
574
- # @example Endpoint Example
575
- # index.php?/api/v2/add_results/:run_id
576
- # @see http://docs.gurock.com/testrail-api2/reference-results
577
- def add_results(run_id, opts = {})
578
- send_post("add_results/#{run_id.to_s}", opts)
579
- end
580
-
581
- ############################
582
- ####add_results_for_cases###
583
- ############################
584
- # Adds one or more new test results, comments or assigns one or more tests (using the case IDs)
585
- # @param run_id [int]
586
- # @param [Hash] opts
587
- # @example Endpoint Example
588
- # index.php?/api/v2/add_results_for_cases/:run_id
589
- # @see http://docs.gurock.com/testrail-api2/reference-results
590
- def add_results_for_cases(run_id, opts = {})
591
- send_post("add_results_for_cases/#{run_id.to_s}", opts)
592
- end
593
-
594
- ##########################==
595
- ####get_run#################
596
- ############################
597
- # Get run by run id
598
- # @param run_id [int]
599
- # @param [Hash] opts
600
- # @example Endpoint Example
601
- # index.php?/api/v2/get_run/:run_id
602
- # @see http://docs.gurock.com/testrail-api2/reference-runs
603
- def get_run(run_id)
604
- send_get("get_run/#{run_id.to_s}")
605
- end
606
-
607
- ##########################==
608
- ####get_runs################
609
- ############################
610
- # Get runs by project id
611
- # @param project_id [int]
612
- # @param plan_id [int]
613
- # @param [Hash] opts
614
- # @example Endpoint Example
615
- # index.php?/api/v2/get_runs/:project_id
616
- # @see http://docs.gurock.com/testrail-api2/reference-runs
617
- def get_runs(project_id, opts = {})
618
- options = param_stringify(opts)
619
- send_get("get_runs/#{project_id.to_s}&#{options}")
620
- end
621
-
622
- ############################
623
- ####add_run#################
624
- ############################
625
- # Add run by suite id
626
- # @param project_id [int]
627
- # @param [Hash] opts
628
- # @example Endpoint Example
629
- # index.php?/api/v2/add_run/:project_id
630
- # @see http://docs.gurock.com/testrail-api2/reference-runs
631
- def add_run(project_id, opts = {})
632
- send_post("add_run/#{project_id.to_s}", opts)
633
- end
634
-
635
- ############################
636
- ####update_run##############
637
- ############################
638
- # Updates existing test run
639
- # @param run_id [int]
640
- # @param [Hash] opts
641
- # @example Endpoint Example
642
- # index.php?/api/v2/update_run/:run_id
643
- # @see http://docs.gurock.com/testrail-api2/reference-runs
644
- def update_run(run_id, opts = {})
645
- send_post("update_run/#{run_id.to_s}", opts)
646
- end
647
-
648
- ############################
649
- ####close_run###############
650
- ############################
651
- # Closes an existing test run and archives its tests & results
652
- # @param run_id [int]
653
- # @param [Hash] opts
654
- # @example Endpoint Example
655
- # index.php?/api/v2/close_run/:run_id
656
- # @see http://docs.gurock.com/testrail-api2/reference-runs
657
- def close_run(run_id, opts = {})
658
- send_post("close_run/#{run_id.to_s}", opts)
659
- end
660
-
661
- ############################
662
- ####delete_run##############
663
- ############################
664
- # Deletes an existing test run.
665
- # @param run_id [int]
666
- # @param [Hash] opts
667
- # @example Endpoint Example
668
- # index.php?/api/v2/delete_run/:run_id
669
- # @see http://docs.gurock.com/testrail-api2/reference-runs
670
- def delete_run(run_id, opts = {})
671
- send_post("delete_run/#{run_id.to_s}", opts)
672
- end
673
-
674
- ##########################==
675
- ####get_test################
676
- ############################
677
- # Returns an existing test
678
- # @param test_id [int]
679
- # @example Endpoint Example
680
- # index.php?/api/v2/get_test/:test_id
681
- # @see http://docs.gurock.com/testrail-api2/reference-tests
682
- def get_test(test_id)
683
- send_get("get_test/#{test_id.to_s}")
684
- end
685
-
686
- ##########################==
687
- ####get_tests###############
688
- ############################
689
- # Returns a list of tests for a test run
690
- # @param run_id [int]
691
- # @param [Hash] opts
692
- # @example Endpoint Example
693
- # index.php?/api/v2/get_tests/:run_id
694
- # @see http://docs.gurock.com/testrail-api2/reference-tests
695
- def get_tests(run_id, opts = {})
696
- options = param_stringify(opts)
697
- send_get("get_tests/#{run_id.to_s}&#{options}")
698
- end
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&section_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