UNPKG

120 kBJavaScriptView Raw
1"use strict";
2/*
3 * ---------------------------------------------------------
4 * Copyright(C) Microsoft Corporation. All rights reserved.
5 * ---------------------------------------------------------
6 *
7 * ---------------------------------------------------------
8 * Generated file, DO NOT EDIT
9 * ---------------------------------------------------------
10 */
11var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13 return new (P || (P = Promise))(function (resolve, reject) {
14 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 });
19};
20Object.defineProperty(exports, "__esModule", { value: true });
21exports.TestApi = void 0;
22const basem = require("./ClientApiBases");
23const TestInterfaces = require("./interfaces/TestInterfaces");
24class TestApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Test-api', options);
27 }
28 /**
29 * Attach a file to test step result
30 *
31 * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel
32 * @param {string} project - Project ID or project name
33 * @param {number} runId - ID of the test run that contains the result.
34 * @param {number} testCaseResultId - ID of the test result that contains the iteration
35 * @param {number} iterationId - ID of the test result iteration.
36 * @param {string} actionPath - Hex value of test result action path.
37 */
38 createTestIterationResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, iterationId, actionPath) {
39 return __awaiter(this, void 0, void 0, function* () {
40 if (iterationId == null) {
41 throw new TypeError('iterationId can not be null or undefined');
42 }
43 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
44 let routeValues = {
45 project: project,
46 runId: runId,
47 testCaseResultId: testCaseResultId
48 };
49 let queryValues = {
50 iterationId: iterationId,
51 actionPath: actionPath,
52 };
53 try {
54 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues);
55 let url = verData.requestUrl;
56 let options = this.createRequestOptions('application/json', verData.apiVersion);
57 let res;
58 res = yield this.rest.create(url, attachmentRequestModel, options);
59 let ret = this.formatResponse(res.result, null, false);
60 resolve(ret);
61 }
62 catch (err) {
63 reject(err);
64 }
65 }));
66 });
67 }
68 /**
69 * Attach a file to a test result.
70 *
71 * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel
72 * @param {string} project - Project ID or project name
73 * @param {number} runId - ID of the test run that contains the result.
74 * @param {number} testCaseResultId - ID of the test result against which attachment has to be uploaded.
75 */
76 createTestResultAttachment(attachmentRequestModel, project, runId, testCaseResultId) {
77 return __awaiter(this, void 0, void 0, function* () {
78 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
79 let routeValues = {
80 project: project,
81 runId: runId,
82 testCaseResultId: testCaseResultId
83 };
84 try {
85 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues);
86 let url = verData.requestUrl;
87 let options = this.createRequestOptions('application/json', verData.apiVersion);
88 let res;
89 res = yield this.rest.create(url, attachmentRequestModel, options);
90 let ret = this.formatResponse(res.result, null, false);
91 resolve(ret);
92 }
93 catch (err) {
94 reject(err);
95 }
96 }));
97 });
98 }
99 /**
100 * Attach a file to a test result
101 *
102 * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment Request Model.
103 * @param {string} project - Project ID or project name
104 * @param {number} runId - ID of the test run that contains the result.
105 * @param {number} testCaseResultId - ID of the test results that contains sub result.
106 * @param {number} testSubResultId - ID of the test sub results against which attachment has to be uploaded.
107 */
108 createTestSubResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, testSubResultId) {
109 return __awaiter(this, void 0, void 0, function* () {
110 if (testSubResultId == null) {
111 throw new TypeError('testSubResultId can not be null or undefined');
112 }
113 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
114 let routeValues = {
115 project: project,
116 runId: runId,
117 testCaseResultId: testCaseResultId
118 };
119 let queryValues = {
120 testSubResultId: testSubResultId,
121 };
122 try {
123 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues);
124 let url = verData.requestUrl;
125 let options = this.createRequestOptions('application/json', verData.apiVersion);
126 let res;
127 res = yield this.rest.create(url, attachmentRequestModel, options);
128 let ret = this.formatResponse(res.result, null, false);
129 resolve(ret);
130 }
131 catch (err) {
132 reject(err);
133 }
134 }));
135 });
136 }
137 /**
138 * Download a test result attachment by its ID.
139 *
140 * @param {string} project - Project ID or project name
141 * @param {number} runId - ID of the test run that contains the testCaseResultId.
142 * @param {number} testCaseResultId - ID of the test result whose attachment has to be downloaded.
143 * @param {number} attachmentId - ID of the test result attachment to be downloaded.
144 */
145 getTestResultAttachmentContent(project, runId, testCaseResultId, attachmentId) {
146 return __awaiter(this, void 0, void 0, function* () {
147 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
148 let routeValues = {
149 project: project,
150 runId: runId,
151 testCaseResultId: testCaseResultId,
152 attachmentId: attachmentId
153 };
154 try {
155 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues);
156 let url = verData.requestUrl;
157 let apiVersion = verData.apiVersion;
158 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
159 resolve((yield this.http.get(url, { "Accept": accept })).message);
160 }
161 catch (err) {
162 reject(err);
163 }
164 }));
165 });
166 }
167 /**
168 * Get list of test result attachments reference.
169 *
170 * @param {string} project - Project ID or project name
171 * @param {number} runId - ID of the test run that contains the result.
172 * @param {number} testCaseResultId - ID of the test result.
173 */
174 getTestResultAttachments(project, runId, testCaseResultId) {
175 return __awaiter(this, void 0, void 0, function* () {
176 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
177 let routeValues = {
178 project: project,
179 runId: runId,
180 testCaseResultId: testCaseResultId
181 };
182 try {
183 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues);
184 let url = verData.requestUrl;
185 let options = this.createRequestOptions('application/json', verData.apiVersion);
186 let res;
187 res = yield this.rest.get(url, options);
188 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true);
189 resolve(ret);
190 }
191 catch (err) {
192 reject(err);
193 }
194 }));
195 });
196 }
197 /**
198 * Download a test result attachment by its ID.
199 *
200 * @param {string} project - Project ID or project name
201 * @param {number} runId - ID of the test run that contains the testCaseResultId.
202 * @param {number} testCaseResultId - ID of the test result whose attachment has to be downloaded.
203 * @param {number} attachmentId - ID of the test result attachment to be downloaded.
204 */
205 getTestResultAttachmentZip(project, runId, testCaseResultId, attachmentId) {
206 return __awaiter(this, void 0, void 0, function* () {
207 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
208 let routeValues = {
209 project: project,
210 runId: runId,
211 testCaseResultId: testCaseResultId,
212 attachmentId: attachmentId
213 };
214 try {
215 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues);
216 let url = verData.requestUrl;
217 let apiVersion = verData.apiVersion;
218 let accept = this.createAcceptHeader("application/zip", apiVersion);
219 resolve((yield this.http.get(url, { "Accept": accept })).message);
220 }
221 catch (err) {
222 reject(err);
223 }
224 }));
225 });
226 }
227 /**
228 * Download a test sub result attachment
229 *
230 * @param {string} project - Project ID or project name
231 * @param {number} runId - ID of the test run that contains the result.
232 * @param {number} testCaseResultId - ID of the test results that contains sub result.
233 * @param {number} attachmentId - ID of the test result attachment to be downloaded
234 * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded
235 */
236 getTestSubResultAttachmentContent(project, runId, testCaseResultId, attachmentId, testSubResultId) {
237 return __awaiter(this, void 0, void 0, function* () {
238 if (testSubResultId == null) {
239 throw new TypeError('testSubResultId can not be null or undefined');
240 }
241 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
242 let routeValues = {
243 project: project,
244 runId: runId,
245 testCaseResultId: testCaseResultId,
246 attachmentId: attachmentId
247 };
248 let queryValues = {
249 testSubResultId: testSubResultId,
250 };
251 try {
252 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues);
253 let url = verData.requestUrl;
254 let apiVersion = verData.apiVersion;
255 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
256 resolve((yield this.http.get(url, { "Accept": accept })).message);
257 }
258 catch (err) {
259 reject(err);
260 }
261 }));
262 });
263 }
264 /**
265 * Get list of test sub result attachments
266 *
267 * @param {string} project - Project ID or project name
268 * @param {number} runId - ID of the test run that contains the result.
269 * @param {number} testCaseResultId - ID of the test results that contains sub result.
270 * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded
271 */
272 getTestSubResultAttachments(project, runId, testCaseResultId, testSubResultId) {
273 return __awaiter(this, void 0, void 0, function* () {
274 if (testSubResultId == null) {
275 throw new TypeError('testSubResultId can not be null or undefined');
276 }
277 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
278 let routeValues = {
279 project: project,
280 runId: runId,
281 testCaseResultId: testCaseResultId
282 };
283 let queryValues = {
284 testSubResultId: testSubResultId,
285 };
286 try {
287 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues);
288 let url = verData.requestUrl;
289 let options = this.createRequestOptions('application/json', verData.apiVersion);
290 let res;
291 res = yield this.rest.get(url, options);
292 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true);
293 resolve(ret);
294 }
295 catch (err) {
296 reject(err);
297 }
298 }));
299 });
300 }
301 /**
302 * Download a test sub result attachment
303 *
304 * @param {string} project - Project ID or project name
305 * @param {number} runId - ID of the test run that contains the result.
306 * @param {number} testCaseResultId - ID of the test results that contains sub result.
307 * @param {number} attachmentId - ID of the test result attachment to be downloaded
308 * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded
309 */
310 getTestSubResultAttachmentZip(project, runId, testCaseResultId, attachmentId, testSubResultId) {
311 return __awaiter(this, void 0, void 0, function* () {
312 if (testSubResultId == null) {
313 throw new TypeError('testSubResultId can not be null or undefined');
314 }
315 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
316 let routeValues = {
317 project: project,
318 runId: runId,
319 testCaseResultId: testCaseResultId,
320 attachmentId: attachmentId
321 };
322 let queryValues = {
323 testSubResultId: testSubResultId,
324 };
325 try {
326 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues);
327 let url = verData.requestUrl;
328 let apiVersion = verData.apiVersion;
329 let accept = this.createAcceptHeader("application/zip", apiVersion);
330 resolve((yield this.http.get(url, { "Accept": accept })).message);
331 }
332 catch (err) {
333 reject(err);
334 }
335 }));
336 });
337 }
338 /**
339 * Attach a file to a test run.
340 *
341 * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel
342 * @param {string} project - Project ID or project name
343 * @param {number} runId - ID of the test run against which attachment has to be uploaded.
344 */
345 createTestRunAttachment(attachmentRequestModel, project, runId) {
346 return __awaiter(this, void 0, void 0, function* () {
347 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
348 let routeValues = {
349 project: project,
350 runId: runId
351 };
352 try {
353 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues);
354 let url = verData.requestUrl;
355 let options = this.createRequestOptions('application/json', verData.apiVersion);
356 let res;
357 res = yield this.rest.create(url, attachmentRequestModel, options);
358 let ret = this.formatResponse(res.result, null, false);
359 resolve(ret);
360 }
361 catch (err) {
362 reject(err);
363 }
364 }));
365 });
366 }
367 /**
368 * Download a test run attachment by its ID.
369 *
370 * @param {string} project - Project ID or project name
371 * @param {number} runId - ID of the test run whose attachment has to be downloaded.
372 * @param {number} attachmentId - ID of the test run attachment to be downloaded.
373 */
374 getTestRunAttachmentContent(project, runId, attachmentId) {
375 return __awaiter(this, void 0, void 0, function* () {
376 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
377 let routeValues = {
378 project: project,
379 runId: runId,
380 attachmentId: attachmentId
381 };
382 try {
383 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues);
384 let url = verData.requestUrl;
385 let apiVersion = verData.apiVersion;
386 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
387 resolve((yield this.http.get(url, { "Accept": accept })).message);
388 }
389 catch (err) {
390 reject(err);
391 }
392 }));
393 });
394 }
395 /**
396 * Get list of test run attachments reference.
397 *
398 * @param {string} project - Project ID or project name
399 * @param {number} runId - ID of the test run.
400 */
401 getTestRunAttachments(project, runId) {
402 return __awaiter(this, void 0, void 0, function* () {
403 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
404 let routeValues = {
405 project: project,
406 runId: runId
407 };
408 try {
409 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues);
410 let url = verData.requestUrl;
411 let options = this.createRequestOptions('application/json', verData.apiVersion);
412 let res;
413 res = yield this.rest.get(url, options);
414 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true);
415 resolve(ret);
416 }
417 catch (err) {
418 reject(err);
419 }
420 }));
421 });
422 }
423 /**
424 * Download a test run attachment by its ID.
425 *
426 * @param {string} project - Project ID or project name
427 * @param {number} runId - ID of the test run whose attachment has to be downloaded.
428 * @param {number} attachmentId - ID of the test run attachment to be downloaded.
429 */
430 getTestRunAttachmentZip(project, runId, attachmentId) {
431 return __awaiter(this, void 0, void 0, function* () {
432 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
433 let routeValues = {
434 project: project,
435 runId: runId,
436 attachmentId: attachmentId
437 };
438 try {
439 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues);
440 let url = verData.requestUrl;
441 let apiVersion = verData.apiVersion;
442 let accept = this.createAcceptHeader("application/zip", apiVersion);
443 resolve((yield this.http.get(url, { "Accept": accept })).message);
444 }
445 catch (err) {
446 reject(err);
447 }
448 }));
449 });
450 }
451 /**
452 * @param {string} project - Project ID or project name
453 * @param {number} runId
454 * @param {number} testCaseResultId
455 */
456 getBugsLinkedToTestResult(project, runId, testCaseResultId) {
457 return __awaiter(this, void 0, void 0, function* () {
458 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
459 let routeValues = {
460 project: project,
461 runId: runId,
462 testCaseResultId: testCaseResultId
463 };
464 try {
465 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "6de20ca2-67de-4faf-97fa-38c5d585eb00", routeValues);
466 let url = verData.requestUrl;
467 let options = this.createRequestOptions('application/json', verData.apiVersion);
468 let res;
469 res = yield this.rest.get(url, options);
470 let ret = this.formatResponse(res.result, null, true);
471 resolve(ret);
472 }
473 catch (err) {
474 reject(err);
475 }
476 }));
477 });
478 }
479 /**
480 * Get code coverage data for a build.
481 *
482 * @param {string} project - Project ID or project name
483 * @param {number} buildId - ID of the build for which code coverage data needs to be fetched.
484 * @param {number} flags - Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData.
485 */
486 getBuildCodeCoverage(project, buildId, flags) {
487 return __awaiter(this, void 0, void 0, function* () {
488 if (buildId == null) {
489 throw new TypeError('buildId can not be null or undefined');
490 }
491 if (flags == null) {
492 throw new TypeError('flags can not be null or undefined');
493 }
494 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
495 let routeValues = {
496 project: project
497 };
498 let queryValues = {
499 buildId: buildId,
500 flags: flags,
501 };
502 try {
503 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues);
504 let url = verData.requestUrl;
505 let options = this.createRequestOptions('application/json', verData.apiVersion);
506 let res;
507 res = yield this.rest.get(url, options);
508 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.BuildCoverage, true);
509 resolve(ret);
510 }
511 catch (err) {
512 reject(err);
513 }
514 }));
515 });
516 }
517 /**
518 * Get Code Coverage Summary for Build.
519 *
520 * @param {string} project - Project ID or project name
521 * @param {number} buildId - ID of the build for which code coverage data needs to be fetched.
522 * @param {number} deltaBuildId - Delta Build id (optional)
523 */
524 getCodeCoverageSummary(project, buildId, deltaBuildId) {
525 return __awaiter(this, void 0, void 0, function* () {
526 if (buildId == null) {
527 throw new TypeError('buildId can not be null or undefined');
528 }
529 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
530 let routeValues = {
531 project: project
532 };
533 let queryValues = {
534 buildId: buildId,
535 deltaBuildId: deltaBuildId,
536 };
537 try {
538 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues);
539 let url = verData.requestUrl;
540 let options = this.createRequestOptions('application/json', verData.apiVersion);
541 let res;
542 res = yield this.rest.get(url, options);
543 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CodeCoverageSummary, false);
544 resolve(ret);
545 }
546 catch (err) {
547 reject(err);
548 }
549 }));
550 });
551 }
552 /**
553 * http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/CodeCoverage?buildId=10 Request: Json of code coverage summary
554 *
555 * @param {TestInterfaces.CodeCoverageData} coverageData
556 * @param {string} project - Project ID or project name
557 * @param {number} buildId
558 */
559 updateCodeCoverageSummary(coverageData, project, buildId) {
560 return __awaiter(this, void 0, void 0, function* () {
561 if (buildId == null) {
562 throw new TypeError('buildId can not be null or undefined');
563 }
564 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
565 let routeValues = {
566 project: project
567 };
568 let queryValues = {
569 buildId: buildId,
570 };
571 try {
572 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues);
573 let url = verData.requestUrl;
574 let options = this.createRequestOptions('application/json', verData.apiVersion);
575 let res;
576 res = yield this.rest.create(url, coverageData, options);
577 let ret = this.formatResponse(res.result, null, false);
578 resolve(ret);
579 }
580 catch (err) {
581 reject(err);
582 }
583 }));
584 });
585 }
586 /**
587 * Get code coverage data for a test run
588 *
589 * @param {string} project - Project ID or project name
590 * @param {number} runId - ID of the test run for which code coverage data needs to be fetched.
591 * @param {number} flags - Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData.
592 */
593 getTestRunCodeCoverage(project, runId, flags) {
594 return __awaiter(this, void 0, void 0, function* () {
595 if (flags == null) {
596 throw new TypeError('flags can not be null or undefined');
597 }
598 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
599 let routeValues = {
600 project: project,
601 runId: runId
602 };
603 let queryValues = {
604 flags: flags,
605 };
606 try {
607 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "9629116f-3b89-4ed8-b358-d4694efda160", routeValues, queryValues);
608 let url = verData.requestUrl;
609 let options = this.createRequestOptions('application/json', verData.apiVersion);
610 let res;
611 res = yield this.rest.get(url, options);
612 let ret = this.formatResponse(res.result, null, true);
613 resolve(ret);
614 }
615 catch (err) {
616 reject(err);
617 }
618 }));
619 });
620 }
621 /**
622 * @param {TestInterfaces.CustomTestFieldDefinition[]} newFields
623 * @param {string} project - Project ID or project name
624 */
625 addCustomFields(newFields, project) {
626 return __awaiter(this, void 0, void 0, function* () {
627 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
628 let routeValues = {
629 project: project
630 };
631 try {
632 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8ce1923b-f4c7-4e22-b93b-f6284e525ec2", routeValues);
633 let url = verData.requestUrl;
634 let options = this.createRequestOptions('application/json', verData.apiVersion);
635 let res;
636 res = yield this.rest.create(url, newFields, options);
637 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CustomTestFieldDefinition, true);
638 resolve(ret);
639 }
640 catch (err) {
641 reject(err);
642 }
643 }));
644 });
645 }
646 /**
647 * @param {string} project - Project ID or project name
648 * @param {TestInterfaces.CustomTestFieldScope} scopeFilter
649 */
650 queryCustomFields(project, scopeFilter) {
651 return __awaiter(this, void 0, void 0, function* () {
652 if (scopeFilter == null) {
653 throw new TypeError('scopeFilter can not be null or undefined');
654 }
655 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
656 let routeValues = {
657 project: project
658 };
659 let queryValues = {
660 scopeFilter: scopeFilter,
661 };
662 try {
663 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8ce1923b-f4c7-4e22-b93b-f6284e525ec2", routeValues, queryValues);
664 let url = verData.requestUrl;
665 let options = this.createRequestOptions('application/json', verData.apiVersion);
666 let res;
667 res = yield this.rest.get(url, options);
668 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CustomTestFieldDefinition, true);
669 resolve(ret);
670 }
671 catch (err) {
672 reject(err);
673 }
674 }));
675 });
676 }
677 /**
678 * @param {TestInterfaces.ResultsFilter} filter
679 * @param {string} project - Project ID or project name
680 */
681 queryTestResultHistory(filter, project) {
682 return __awaiter(this, void 0, void 0, function* () {
683 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
684 let routeValues = {
685 project: project
686 };
687 try {
688 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "234616f5-429c-4e7b-9192-affd76731dfd", routeValues);
689 let url = verData.requestUrl;
690 let options = this.createRequestOptions('application/json', verData.apiVersion);
691 let res;
692 res = yield this.rest.create(url, filter, options);
693 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultHistory, false);
694 resolve(ret);
695 }
696 catch (err) {
697 reject(err);
698 }
699 }));
700 });
701 }
702 /**
703 * Get iteration for a result
704 *
705 * @param {string} project - Project ID or project name
706 * @param {number} runId - ID of the test run that contains the result.
707 * @param {number} testCaseResultId - ID of the test result that contains the iterations.
708 * @param {number} iterationId - Id of the test results Iteration.
709 * @param {boolean} includeActionResults - Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration.
710 */
711 getTestIteration(project, runId, testCaseResultId, iterationId, includeActionResults) {
712 return __awaiter(this, void 0, void 0, function* () {
713 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
714 let routeValues = {
715 project: project,
716 runId: runId,
717 testCaseResultId: testCaseResultId,
718 iterationId: iterationId
719 };
720 let queryValues = {
721 includeActionResults: includeActionResults,
722 };
723 try {
724 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "73eb9074-3446-4c44-8296-2f811950ff8d", routeValues, queryValues);
725 let url = verData.requestUrl;
726 let options = this.createRequestOptions('application/json', verData.apiVersion);
727 let res;
728 res = yield this.rest.get(url, options);
729 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestIterationDetailsModel, false);
730 resolve(ret);
731 }
732 catch (err) {
733 reject(err);
734 }
735 }));
736 });
737 }
738 /**
739 * Get iterations for a result
740 *
741 * @param {string} project - Project ID or project name
742 * @param {number} runId - ID of the test run that contains the result.
743 * @param {number} testCaseResultId - ID of the test result that contains the iterations.
744 * @param {boolean} includeActionResults - Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration.
745 */
746 getTestIterations(project, runId, testCaseResultId, includeActionResults) {
747 return __awaiter(this, void 0, void 0, function* () {
748 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
749 let routeValues = {
750 project: project,
751 runId: runId,
752 testCaseResultId: testCaseResultId
753 };
754 let queryValues = {
755 includeActionResults: includeActionResults,
756 };
757 try {
758 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "73eb9074-3446-4c44-8296-2f811950ff8d", routeValues, queryValues);
759 let url = verData.requestUrl;
760 let options = this.createRequestOptions('application/json', verData.apiVersion);
761 let res;
762 res = yield this.rest.get(url, options);
763 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestIterationDetailsModel, true);
764 resolve(ret);
765 }
766 catch (err) {
767 reject(err);
768 }
769 }));
770 });
771 }
772 /**
773 * @param {TestInterfaces.LinkedWorkItemsQuery} workItemQuery
774 * @param {string} project - Project ID or project name
775 */
776 getLinkedWorkItemsByQuery(workItemQuery, project) {
777 return __awaiter(this, void 0, void 0, function* () {
778 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
779 let routeValues = {
780 project: project
781 };
782 try {
783 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a4dcb25b-9878-49ea-abfd-e440bd9b1dcd", routeValues);
784 let url = verData.requestUrl;
785 let options = this.createRequestOptions('application/json', verData.apiVersion);
786 let res;
787 res = yield this.rest.create(url, workItemQuery, options);
788 let ret = this.formatResponse(res.result, null, true);
789 resolve(ret);
790 }
791 catch (err) {
792 reject(err);
793 }
794 }));
795 });
796 }
797 /**
798 * Get test run message logs
799 *
800 * @param {string} project - Project ID or project name
801 * @param {number} runId - ID of the run to get.
802 */
803 getTestRunLogs(project, runId) {
804 return __awaiter(this, void 0, void 0, function* () {
805 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
806 let routeValues = {
807 project: project,
808 runId: runId
809 };
810 try {
811 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a1e55200-637e-42e9-a7c0-7e5bfdedb1b3", routeValues);
812 let url = verData.requestUrl;
813 let options = this.createRequestOptions('application/json', verData.apiVersion);
814 let res;
815 res = yield this.rest.get(url, options);
816 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestMessageLogDetails, true);
817 resolve(ret);
818 }
819 catch (err) {
820 reject(err);
821 }
822 }));
823 });
824 }
825 /**
826 * Get a test point.
827 *
828 * @param {string} project - Project ID or project name
829 * @param {number} planId - ID of the test plan.
830 * @param {number} suiteId - ID of the suite that contains the point.
831 * @param {number} pointIds - ID of the test point to get.
832 * @param {string} witFields - Comma-separated list of work item field names.
833 */
834 getPoint(project, planId, suiteId, pointIds, witFields) {
835 return __awaiter(this, void 0, void 0, function* () {
836 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
837 let routeValues = {
838 project: project,
839 planId: planId,
840 suiteId: suiteId,
841 pointIds: pointIds
842 };
843 let queryValues = {
844 witFields: witFields,
845 };
846 try {
847 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues, queryValues);
848 let url = verData.requestUrl;
849 let options = this.createRequestOptions('application/json', verData.apiVersion);
850 let res;
851 res = yield this.rest.get(url, options);
852 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, false);
853 resolve(ret);
854 }
855 catch (err) {
856 reject(err);
857 }
858 }));
859 });
860 }
861 /**
862 * Get a list of test points.
863 *
864 * @param {string} project - Project ID or project name
865 * @param {number} planId - ID of the test plan.
866 * @param {number} suiteId - ID of the suite that contains the points.
867 * @param {string} witFields - Comma-separated list of work item field names.
868 * @param {string} configurationId - Get test points for specific configuration.
869 * @param {string} testCaseId - Get test points for a specific test case, valid when configurationId is not set.
870 * @param {string} testPointIds - Get test points for comma-separated list of test point IDs, valid only when configurationId and testCaseId are not set.
871 * @param {boolean} includePointDetails - Include all properties for the test point.
872 * @param {number} skip - Number of test points to skip..
873 * @param {number} top - Number of test points to return.
874 */
875 getPoints(project, planId, suiteId, witFields, configurationId, testCaseId, testPointIds, includePointDetails, skip, top) {
876 return __awaiter(this, void 0, void 0, function* () {
877 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
878 let routeValues = {
879 project: project,
880 planId: planId,
881 suiteId: suiteId
882 };
883 let queryValues = {
884 witFields: witFields,
885 configurationId: configurationId,
886 testCaseId: testCaseId,
887 testPointIds: testPointIds,
888 includePointDetails: includePointDetails,
889 '$skip': skip,
890 '$top': top,
891 };
892 try {
893 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues, queryValues);
894 let url = verData.requestUrl;
895 let options = this.createRequestOptions('application/json', verData.apiVersion);
896 let res;
897 res = yield this.rest.get(url, options);
898 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, true);
899 resolve(ret);
900 }
901 catch (err) {
902 reject(err);
903 }
904 }));
905 });
906 }
907 /**
908 * Update test points.
909 *
910 * @param {TestInterfaces.PointUpdateModel} pointUpdateModel - Data to update.
911 * @param {string} project - Project ID or project name
912 * @param {number} planId - ID of the test plan.
913 * @param {number} suiteId - ID of the suite that contains the points.
914 * @param {string} pointIds - ID of the test point to get. Use a comma-separated list of IDs to update multiple test points.
915 */
916 updateTestPoints(pointUpdateModel, project, planId, suiteId, pointIds) {
917 return __awaiter(this, void 0, void 0, function* () {
918 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
919 let routeValues = {
920 project: project,
921 planId: planId,
922 suiteId: suiteId,
923 pointIds: pointIds
924 };
925 try {
926 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues);
927 let url = verData.requestUrl;
928 let options = this.createRequestOptions('application/json', verData.apiVersion);
929 let res;
930 res = yield this.rest.update(url, pointUpdateModel, options);
931 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, true);
932 resolve(ret);
933 }
934 catch (err) {
935 reject(err);
936 }
937 }));
938 });
939 }
940 /**
941 * Get test points using query.
942 *
943 * @param {TestInterfaces.TestPointsQuery} query - TestPointsQuery to get test points.
944 * @param {string} project - Project ID or project name
945 * @param {number} skip - Number of test points to skip..
946 * @param {number} top - Number of test points to return.
947 */
948 getPointsByQuery(query, project, skip, top) {
949 return __awaiter(this, void 0, void 0, function* () {
950 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
951 let routeValues = {
952 project: project
953 };
954 let queryValues = {
955 '$skip': skip,
956 '$top': top,
957 };
958 try {
959 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "b4264fd0-a5d1-43e2-82a5-b9c46b7da9ce", routeValues, queryValues);
960 let url = verData.requestUrl;
961 let options = this.createRequestOptions('application/json', verData.apiVersion);
962 let res;
963 res = yield this.rest.create(url, query, options);
964 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPointsQuery, false);
965 resolve(ret);
966 }
967 catch (err) {
968 reject(err);
969 }
970 }));
971 });
972 }
973 /**
974 * @param {string} project - Project ID or project name
975 * @param {number} buildId
976 * @param {string} publishContext
977 * @param {string} groupBy
978 * @param {string} filter
979 * @param {string} orderby
980 * @param {boolean} shouldIncludeResults
981 * @param {boolean} queryRunSummaryForInProgress
982 */
983 getTestResultDetailsForBuild(project, buildId, publishContext, groupBy, filter, orderby, shouldIncludeResults, queryRunSummaryForInProgress) {
984 return __awaiter(this, void 0, void 0, function* () {
985 if (buildId == null) {
986 throw new TypeError('buildId can not be null or undefined');
987 }
988 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
989 let routeValues = {
990 project: project
991 };
992 let queryValues = {
993 buildId: buildId,
994 publishContext: publishContext,
995 groupBy: groupBy,
996 '$filter': filter,
997 '$orderby': orderby,
998 shouldIncludeResults: shouldIncludeResults,
999 queryRunSummaryForInProgress: queryRunSummaryForInProgress,
1000 };
1001 try {
1002 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "efb387b0-10d5-42e7-be40-95e06ee9430f", routeValues, queryValues);
1003 let url = verData.requestUrl;
1004 let options = this.createRequestOptions('application/json', verData.apiVersion);
1005 let res;
1006 res = yield this.rest.get(url, options);
1007 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsDetails, false);
1008 resolve(ret);
1009 }
1010 catch (err) {
1011 reject(err);
1012 }
1013 }));
1014 });
1015 }
1016 /**
1017 * @param {string} project - Project ID or project name
1018 * @param {number} releaseId
1019 * @param {number} releaseEnvId
1020 * @param {string} publishContext
1021 * @param {string} groupBy
1022 * @param {string} filter
1023 * @param {string} orderby
1024 * @param {boolean} shouldIncludeResults
1025 * @param {boolean} queryRunSummaryForInProgress
1026 */
1027 getTestResultDetailsForRelease(project, releaseId, releaseEnvId, publishContext, groupBy, filter, orderby, shouldIncludeResults, queryRunSummaryForInProgress) {
1028 return __awaiter(this, void 0, void 0, function* () {
1029 if (releaseId == null) {
1030 throw new TypeError('releaseId can not be null or undefined');
1031 }
1032 if (releaseEnvId == null) {
1033 throw new TypeError('releaseEnvId can not be null or undefined');
1034 }
1035 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1036 let routeValues = {
1037 project: project
1038 };
1039 let queryValues = {
1040 releaseId: releaseId,
1041 releaseEnvId: releaseEnvId,
1042 publishContext: publishContext,
1043 groupBy: groupBy,
1044 '$filter': filter,
1045 '$orderby': orderby,
1046 shouldIncludeResults: shouldIncludeResults,
1047 queryRunSummaryForInProgress: queryRunSummaryForInProgress,
1048 };
1049 try {
1050 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "b834ec7e-35bb-450f-a3c8-802e70ca40dd", routeValues, queryValues);
1051 let url = verData.requestUrl;
1052 let options = this.createRequestOptions('application/json', verData.apiVersion);
1053 let res;
1054 res = yield this.rest.get(url, options);
1055 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsDetails, false);
1056 resolve(ret);
1057 }
1058 catch (err) {
1059 reject(err);
1060 }
1061 }));
1062 });
1063 }
1064 /**
1065 * @param {TestInterfaces.TestResultDocument} document
1066 * @param {string} project - Project ID or project name
1067 * @param {number} runId
1068 */
1069 publishTestResultDocument(document, project, runId) {
1070 return __awaiter(this, void 0, void 0, function* () {
1071 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1072 let routeValues = {
1073 project: project,
1074 runId: runId
1075 };
1076 try {
1077 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "370ca04b-8eec-4ca8-8ba3-d24dca228791", routeValues);
1078 let url = verData.requestUrl;
1079 let options = this.createRequestOptions('application/json', verData.apiVersion);
1080 let res;
1081 res = yield this.rest.create(url, document, options);
1082 let ret = this.formatResponse(res.result, null, false);
1083 resolve(ret);
1084 }
1085 catch (err) {
1086 reject(err);
1087 }
1088 }));
1089 });
1090 }
1091 /**
1092 * @param {string} project - Project ID or project name
1093 * @param {number} buildId
1094 * @param {string} publishContext
1095 * @param {string[]} fields
1096 * @param {string} continuationToken
1097 */
1098 getResultGroupsByBuild(project, buildId, publishContext, fields, continuationToken) {
1099 return __awaiter(this, void 0, void 0, function* () {
1100 if (buildId == null) {
1101 throw new TypeError('buildId can not be null or undefined');
1102 }
1103 if (publishContext == null) {
1104 throw new TypeError('publishContext can not be null or undefined');
1105 }
1106 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1107 let routeValues = {
1108 project: project
1109 };
1110 let queryValues = {
1111 buildId: buildId,
1112 publishContext: publishContext,
1113 fields: fields && fields.join(","),
1114 continuationToken: continuationToken,
1115 };
1116 try {
1117 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "d279d052-c55a-4204-b913-42f733b52958", routeValues, queryValues);
1118 let url = verData.requestUrl;
1119 let options = this.createRequestOptions('application/json', verData.apiVersion);
1120 let res;
1121 res = yield this.rest.get(url, options);
1122 let ret = this.formatResponse(res.result, null, true);
1123 resolve(ret);
1124 }
1125 catch (err) {
1126 reject(err);
1127 }
1128 }));
1129 });
1130 }
1131 /**
1132 * @param {string} project - Project ID or project name
1133 * @param {number} releaseId
1134 * @param {string} publishContext
1135 * @param {number} releaseEnvId
1136 * @param {string[]} fields
1137 * @param {string} continuationToken
1138 */
1139 getResultGroupsByRelease(project, releaseId, publishContext, releaseEnvId, fields, continuationToken) {
1140 return __awaiter(this, void 0, void 0, function* () {
1141 if (releaseId == null) {
1142 throw new TypeError('releaseId can not be null or undefined');
1143 }
1144 if (publishContext == null) {
1145 throw new TypeError('publishContext can not be null or undefined');
1146 }
1147 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1148 let routeValues = {
1149 project: project
1150 };
1151 let queryValues = {
1152 releaseId: releaseId,
1153 publishContext: publishContext,
1154 releaseEnvId: releaseEnvId,
1155 fields: fields && fields.join(","),
1156 continuationToken: continuationToken,
1157 };
1158 try {
1159 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "ef5ce5d4-a4e5-47ee-804c-354518f8d03f", routeValues, queryValues);
1160 let url = verData.requestUrl;
1161 let options = this.createRequestOptions('application/json', verData.apiVersion);
1162 let res;
1163 res = yield this.rest.get(url, options);
1164 let ret = this.formatResponse(res.result, null, true);
1165 resolve(ret);
1166 }
1167 catch (err) {
1168 reject(err);
1169 }
1170 }));
1171 });
1172 }
1173 /**
1174 * Get list of test Result meta data details for corresponding testcasereferenceId
1175 *
1176 * @param {string[]} testReferenceIds - TestCaseReference Ids of the test Result to be queried, comma separated list of valid ids (limit no. of ids 200).
1177 * @param {string} project - Project ID or project name
1178 */
1179 queryTestResultsMetaData(testReferenceIds, project) {
1180 return __awaiter(this, void 0, void 0, function* () {
1181 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1182 let routeValues = {
1183 project: project
1184 };
1185 try {
1186 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "afa7830e-67a7-4336-8090-2b448ca80295", routeValues);
1187 let url = verData.requestUrl;
1188 let options = this.createRequestOptions('application/json', verData.apiVersion);
1189 let res;
1190 res = yield this.rest.create(url, testReferenceIds, options);
1191 let ret = this.formatResponse(res.result, null, true);
1192 resolve(ret);
1193 }
1194 catch (err) {
1195 reject(err);
1196 }
1197 }));
1198 });
1199 }
1200 /**
1201 * Get test result retention settings
1202 *
1203 * @param {string} project - Project ID or project name
1204 */
1205 getResultRetentionSettings(project) {
1206 return __awaiter(this, void 0, void 0, function* () {
1207 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1208 let routeValues = {
1209 project: project
1210 };
1211 try {
1212 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a3206d9e-fa8d-42d3-88cb-f75c51e69cde", routeValues);
1213 let url = verData.requestUrl;
1214 let options = this.createRequestOptions('application/json', verData.apiVersion);
1215 let res;
1216 res = yield this.rest.get(url, options);
1217 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.ResultRetentionSettings, false);
1218 resolve(ret);
1219 }
1220 catch (err) {
1221 reject(err);
1222 }
1223 }));
1224 });
1225 }
1226 /**
1227 * Update test result retention settings
1228 *
1229 * @param {TestInterfaces.ResultRetentionSettings} retentionSettings - Test result retention settings details to be updated
1230 * @param {string} project - Project ID or project name
1231 */
1232 updateResultRetentionSettings(retentionSettings, project) {
1233 return __awaiter(this, void 0, void 0, function* () {
1234 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1235 let routeValues = {
1236 project: project
1237 };
1238 try {
1239 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a3206d9e-fa8d-42d3-88cb-f75c51e69cde", routeValues);
1240 let url = verData.requestUrl;
1241 let options = this.createRequestOptions('application/json', verData.apiVersion);
1242 let res;
1243 res = yield this.rest.update(url, retentionSettings, options);
1244 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.ResultRetentionSettings, false);
1245 resolve(ret);
1246 }
1247 catch (err) {
1248 reject(err);
1249 }
1250 }));
1251 });
1252 }
1253 /**
1254 * Add test results to a test run.
1255 *
1256 * @param {TestInterfaces.TestCaseResult[]} results - List of test results to add.
1257 * @param {string} project - Project ID or project name
1258 * @param {number} runId - Test run ID into which test results to add.
1259 */
1260 addTestResultsToTestRun(results, project, runId) {
1261 return __awaiter(this, void 0, void 0, function* () {
1262 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1263 let routeValues = {
1264 project: project,
1265 runId: runId
1266 };
1267 try {
1268 let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues);
1269 let url = verData.requestUrl;
1270 let options = this.createRequestOptions('application/json', verData.apiVersion);
1271 let res;
1272 res = yield this.rest.create(url, results, options);
1273 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true);
1274 resolve(ret);
1275 }
1276 catch (err) {
1277 reject(err);
1278 }
1279 }));
1280 });
1281 }
1282 /**
1283 * Get a test result for a test run.
1284 *
1285 * @param {string} project - Project ID or project name
1286 * @param {number} runId - Test run ID of a test result to fetch.
1287 * @param {number} testCaseResultId - Test result ID.
1288 * @param {TestInterfaces.ResultDetails} detailsToInclude - Details to include with test results. Default is None. Other values are Iterations, WorkItems and SubResults.
1289 */
1290 getTestResultById(project, runId, testCaseResultId, detailsToInclude) {
1291 return __awaiter(this, void 0, void 0, function* () {
1292 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1293 let routeValues = {
1294 project: project,
1295 runId: runId,
1296 testCaseResultId: testCaseResultId
1297 };
1298 let queryValues = {
1299 detailsToInclude: detailsToInclude,
1300 };
1301 try {
1302 let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues, queryValues);
1303 let url = verData.requestUrl;
1304 let options = this.createRequestOptions('application/json', verData.apiVersion);
1305 let res;
1306 res = yield this.rest.get(url, options);
1307 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, false);
1308 resolve(ret);
1309 }
1310 catch (err) {
1311 reject(err);
1312 }
1313 }));
1314 });
1315 }
1316 /**
1317 * Get test results for a test run.
1318 *
1319 * @param {string} project - Project ID or project name
1320 * @param {number} runId - Test run ID of test results to fetch.
1321 * @param {TestInterfaces.ResultDetails} detailsToInclude - Details to include with test results. Default is None. Other values are Iterations and WorkItems.
1322 * @param {number} skip - Number of test results to skip from beginning.
1323 * @param {number} top - Number of test results to return. Maximum is 1000 when detailsToInclude is None and 200 otherwise.
1324 * @param {TestInterfaces.TestOutcome[]} outcomes - Comma separated list of test outcomes to filter test results.
1325 */
1326 getTestResults(project, runId, detailsToInclude, skip, top, outcomes) {
1327 return __awaiter(this, void 0, void 0, function* () {
1328 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1329 let routeValues = {
1330 project: project,
1331 runId: runId
1332 };
1333 let queryValues = {
1334 detailsToInclude: detailsToInclude,
1335 '$skip': skip,
1336 '$top': top,
1337 outcomes: outcomes && outcomes.join(","),
1338 };
1339 try {
1340 let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues, queryValues);
1341 let url = verData.requestUrl;
1342 let options = this.createRequestOptions('application/json', verData.apiVersion);
1343 let res;
1344 res = yield this.rest.get(url, options);
1345 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true);
1346 resolve(ret);
1347 }
1348 catch (err) {
1349 reject(err);
1350 }
1351 }));
1352 });
1353 }
1354 /**
1355 * Update test results in a test run.
1356 *
1357 * @param {TestInterfaces.TestCaseResult[]} results - List of test results to update.
1358 * @param {string} project - Project ID or project name
1359 * @param {number} runId - Test run ID whose test results to update.
1360 */
1361 updateTestResults(results, project, runId) {
1362 return __awaiter(this, void 0, void 0, function* () {
1363 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1364 let routeValues = {
1365 project: project,
1366 runId: runId
1367 };
1368 try {
1369 let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues);
1370 let url = verData.requestUrl;
1371 let options = this.createRequestOptions('application/json', verData.apiVersion);
1372 let res;
1373 res = yield this.rest.update(url, results, options);
1374 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true);
1375 resolve(ret);
1376 }
1377 catch (err) {
1378 reject(err);
1379 }
1380 }));
1381 });
1382 }
1383 /**
1384 * This API will return results by Ids with fields specified/trend for particular automated test method. We are still improving this API and have not finalized proper signature and contract.
1385 *
1386 * @param {TestInterfaces.TestResultsQuery} query
1387 * @param {string} project - Project ID or project name
1388 */
1389 getTestResultsByQuery(query, project) {
1390 return __awaiter(this, void 0, void 0, function* () {
1391 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1392 let routeValues = {
1393 project: project
1394 };
1395 try {
1396 let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "6711da49-8e6f-4d35-9f73-cef7a3c81a5b", routeValues);
1397 let url = verData.requestUrl;
1398 let options = this.createRequestOptions('application/json', verData.apiVersion);
1399 let res;
1400 res = yield this.rest.create(url, query, options);
1401 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsQuery, false);
1402 resolve(ret);
1403 }
1404 catch (err) {
1405 reject(err);
1406 }
1407 }));
1408 });
1409 }
1410 /**
1411 * @param {string} project - Project ID or project name
1412 * @param {number} buildId
1413 * @param {string} publishContext
1414 * @param {TestInterfaces.TestOutcome[]} outcomes
1415 * @param {number} top
1416 * @param {string} continuationToken
1417 */
1418 getTestResultsByBuild(project, buildId, publishContext, outcomes, top, continuationToken) {
1419 return __awaiter(this, void 0, void 0, function* () {
1420 if (buildId == null) {
1421 throw new TypeError('buildId can not be null or undefined');
1422 }
1423 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1424 let routeValues = {
1425 project: project
1426 };
1427 let queryValues = {
1428 buildId: buildId,
1429 publishContext: publishContext,
1430 outcomes: outcomes && outcomes.join(","),
1431 '$top': top,
1432 continuationToken: continuationToken,
1433 };
1434 try {
1435 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "3c191b88-615b-4be2-b7d9-5ff9141e91d4", routeValues, queryValues);
1436 let url = verData.requestUrl;
1437 let options = this.createRequestOptions('application/json', verData.apiVersion);
1438 let res;
1439 res = yield this.rest.get(url, options);
1440 let ret = this.formatResponse(res.result, null, true);
1441 resolve(ret);
1442 }
1443 catch (err) {
1444 reject(err);
1445 }
1446 }));
1447 });
1448 }
1449 /**
1450 * @param {string} project - Project ID or project name
1451 * @param {number} releaseId
1452 * @param {number} releaseEnvid
1453 * @param {string} publishContext
1454 * @param {TestInterfaces.TestOutcome[]} outcomes
1455 * @param {number} top
1456 * @param {string} continuationToken
1457 */
1458 getTestResultsByRelease(project, releaseId, releaseEnvid, publishContext, outcomes, top, continuationToken) {
1459 return __awaiter(this, void 0, void 0, function* () {
1460 if (releaseId == null) {
1461 throw new TypeError('releaseId can not be null or undefined');
1462 }
1463 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1464 let routeValues = {
1465 project: project
1466 };
1467 let queryValues = {
1468 releaseId: releaseId,
1469 releaseEnvid: releaseEnvid,
1470 publishContext: publishContext,
1471 outcomes: outcomes && outcomes.join(","),
1472 '$top': top,
1473 continuationToken: continuationToken,
1474 };
1475 try {
1476 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "ce01820b-83f3-4c15-a583-697a43292c4e", routeValues, queryValues);
1477 let url = verData.requestUrl;
1478 let options = this.createRequestOptions('application/json', verData.apiVersion);
1479 let res;
1480 res = yield this.rest.get(url, options);
1481 let ret = this.formatResponse(res.result, null, true);
1482 resolve(ret);
1483 }
1484 catch (err) {
1485 reject(err);
1486 }
1487 }));
1488 });
1489 }
1490 /**
1491 * @param {string} project - Project ID or project name
1492 * @param {number} buildId
1493 * @param {string} publishContext
1494 * @param {boolean} includeFailureDetails
1495 * @param {TestInterfaces.BuildReference} buildToCompare
1496 */
1497 queryTestResultsReportForBuild(project, buildId, publishContext, includeFailureDetails, buildToCompare) {
1498 return __awaiter(this, void 0, void 0, function* () {
1499 if (buildId == null) {
1500 throw new TypeError('buildId can not be null or undefined');
1501 }
1502 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1503 let routeValues = {
1504 project: project
1505 };
1506 let queryValues = {
1507 buildId: buildId,
1508 publishContext: publishContext,
1509 includeFailureDetails: includeFailureDetails,
1510 buildToCompare: buildToCompare,
1511 };
1512 try {
1513 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "000ef77b-fea2-498d-a10d-ad1a037f559f", routeValues, queryValues);
1514 let url = verData.requestUrl;
1515 let options = this.createRequestOptions('application/json', verData.apiVersion);
1516 let res;
1517 res = yield this.rest.get(url, options);
1518 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, false);
1519 resolve(ret);
1520 }
1521 catch (err) {
1522 reject(err);
1523 }
1524 }));
1525 });
1526 }
1527 /**
1528 * @param {string} project - Project ID or project name
1529 * @param {number} releaseId
1530 * @param {number} releaseEnvId
1531 * @param {string} publishContext
1532 * @param {boolean} includeFailureDetails
1533 * @param {TestInterfaces.ReleaseReference} releaseToCompare
1534 */
1535 queryTestResultsReportForRelease(project, releaseId, releaseEnvId, publishContext, includeFailureDetails, releaseToCompare) {
1536 return __awaiter(this, void 0, void 0, function* () {
1537 if (releaseId == null) {
1538 throw new TypeError('releaseId can not be null or undefined');
1539 }
1540 if (releaseEnvId == null) {
1541 throw new TypeError('releaseEnvId can not be null or undefined');
1542 }
1543 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1544 let routeValues = {
1545 project: project
1546 };
1547 let queryValues = {
1548 releaseId: releaseId,
1549 releaseEnvId: releaseEnvId,
1550 publishContext: publishContext,
1551 includeFailureDetails: includeFailureDetails,
1552 releaseToCompare: releaseToCompare,
1553 };
1554 try {
1555 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "85765790-ac68-494e-b268-af36c3929744", routeValues, queryValues);
1556 let url = verData.requestUrl;
1557 let options = this.createRequestOptions('application/json', verData.apiVersion);
1558 let res;
1559 res = yield this.rest.get(url, options);
1560 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, false);
1561 resolve(ret);
1562 }
1563 catch (err) {
1564 reject(err);
1565 }
1566 }));
1567 });
1568 }
1569 /**
1570 * @param {TestInterfaces.ReleaseReference[]} releases
1571 * @param {string} project - Project ID or project name
1572 */
1573 queryTestResultsSummaryForReleases(releases, project) {
1574 return __awaiter(this, void 0, void 0, function* () {
1575 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1576 let routeValues = {
1577 project: project
1578 };
1579 try {
1580 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "85765790-ac68-494e-b268-af36c3929744", routeValues);
1581 let url = verData.requestUrl;
1582 let options = this.createRequestOptions('application/json', verData.apiVersion);
1583 let res;
1584 res = yield this.rest.create(url, releases, options);
1585 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, true);
1586 resolve(ret);
1587 }
1588 catch (err) {
1589 reject(err);
1590 }
1591 }));
1592 });
1593 }
1594 /**
1595 * @param {TestInterfaces.TestResultsContext} resultsContext
1596 * @param {string} project - Project ID or project name
1597 * @param {number[]} workItemIds
1598 */
1599 queryTestSummaryByRequirement(resultsContext, project, workItemIds) {
1600 return __awaiter(this, void 0, void 0, function* () {
1601 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1602 let routeValues = {
1603 project: project
1604 };
1605 let queryValues = {
1606 workItemIds: workItemIds && workItemIds.join(","),
1607 };
1608 try {
1609 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "cd08294e-308d-4460-a46e-4cfdefba0b4b", routeValues, queryValues);
1610 let url = verData.requestUrl;
1611 let options = this.createRequestOptions('application/json', verData.apiVersion);
1612 let res;
1613 res = yield this.rest.create(url, resultsContext, options);
1614 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSummaryForWorkItem, true);
1615 resolve(ret);
1616 }
1617 catch (err) {
1618 reject(err);
1619 }
1620 }));
1621 });
1622 }
1623 /**
1624 * @param {TestInterfaces.TestResultTrendFilter} filter
1625 * @param {string} project - Project ID or project name
1626 */
1627 queryResultTrendForBuild(filter, project) {
1628 return __awaiter(this, void 0, void 0, function* () {
1629 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1630 let routeValues = {
1631 project: project
1632 };
1633 try {
1634 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "fbc82a85-0786-4442-88bb-eb0fda6b01b0", routeValues);
1635 let url = verData.requestUrl;
1636 let options = this.createRequestOptions('application/json', verData.apiVersion);
1637 let res;
1638 res = yield this.rest.create(url, filter, options);
1639 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.AggregatedDataForResultTrend, true);
1640 resolve(ret);
1641 }
1642 catch (err) {
1643 reject(err);
1644 }
1645 }));
1646 });
1647 }
1648 /**
1649 * @param {TestInterfaces.TestResultTrendFilter} filter
1650 * @param {string} project - Project ID or project name
1651 */
1652 queryResultTrendForRelease(filter, project) {
1653 return __awaiter(this, void 0, void 0, function* () {
1654 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1655 let routeValues = {
1656 project: project
1657 };
1658 try {
1659 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "dd178e93-d8dd-4887-9635-d6b9560b7b6e", routeValues);
1660 let url = verData.requestUrl;
1661 let options = this.createRequestOptions('application/json', verData.apiVersion);
1662 let res;
1663 res = yield this.rest.create(url, filter, options);
1664 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.AggregatedDataForResultTrend, true);
1665 resolve(ret);
1666 }
1667 catch (err) {
1668 reject(err);
1669 }
1670 }));
1671 });
1672 }
1673 /**
1674 * Get test run statistics , used when we want to get summary of a run by outcome.
1675 *
1676 * @param {string} project - Project ID or project name
1677 * @param {number} runId - ID of the run to get.
1678 */
1679 getTestRunStatistics(project, runId) {
1680 return __awaiter(this, void 0, void 0, function* () {
1681 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1682 let routeValues = {
1683 project: project,
1684 runId: runId
1685 };
1686 try {
1687 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "0a42c424-d764-4a16-a2d5-5c85f87d0ae8", routeValues);
1688 let url = verData.requestUrl;
1689 let options = this.createRequestOptions('application/json', verData.apiVersion);
1690 let res;
1691 res = yield this.rest.get(url, options);
1692 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRunStatistic, false);
1693 resolve(ret);
1694 }
1695 catch (err) {
1696 reject(err);
1697 }
1698 }));
1699 });
1700 }
1701 /**
1702 * Create new test run.
1703 *
1704 * @param {TestInterfaces.RunCreateModel} testRun - Run details RunCreateModel
1705 * @param {string} project - Project ID or project name
1706 */
1707 createTestRun(testRun, project) {
1708 return __awaiter(this, void 0, void 0, function* () {
1709 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1710 let routeValues = {
1711 project: project
1712 };
1713 try {
1714 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues);
1715 let url = verData.requestUrl;
1716 let options = this.createRequestOptions('application/json', verData.apiVersion);
1717 let res;
1718 res = yield this.rest.create(url, testRun, options);
1719 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false);
1720 resolve(ret);
1721 }
1722 catch (err) {
1723 reject(err);
1724 }
1725 }));
1726 });
1727 }
1728 /**
1729 * Delete a test run by its ID.
1730 *
1731 * @param {string} project - Project ID or project name
1732 * @param {number} runId - ID of the run to delete.
1733 */
1734 deleteTestRun(project, runId) {
1735 return __awaiter(this, void 0, void 0, function* () {
1736 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1737 let routeValues = {
1738 project: project,
1739 runId: runId
1740 };
1741 try {
1742 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues);
1743 let url = verData.requestUrl;
1744 let options = this.createRequestOptions('application/json', verData.apiVersion);
1745 let res;
1746 res = yield this.rest.del(url, options);
1747 let ret = this.formatResponse(res.result, null, false);
1748 resolve(ret);
1749 }
1750 catch (err) {
1751 reject(err);
1752 }
1753 }));
1754 });
1755 }
1756 /**
1757 * Get a test run by its ID.
1758 *
1759 * @param {string} project - Project ID or project name
1760 * @param {number} runId - ID of the run to get.
1761 * @param {boolean} includeDetails - Default value is true. It includes details like run statistics, release, build, test environment, post process state, and more.
1762 */
1763 getTestRunById(project, runId, includeDetails) {
1764 return __awaiter(this, void 0, void 0, function* () {
1765 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1766 let routeValues = {
1767 project: project,
1768 runId: runId
1769 };
1770 let queryValues = {
1771 includeDetails: includeDetails,
1772 };
1773 try {
1774 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues);
1775 let url = verData.requestUrl;
1776 let options = this.createRequestOptions('application/json', verData.apiVersion);
1777 let res;
1778 res = yield this.rest.get(url, options);
1779 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false);
1780 resolve(ret);
1781 }
1782 catch (err) {
1783 reject(err);
1784 }
1785 }));
1786 });
1787 }
1788 /**
1789 * Get a list of test runs.
1790 *
1791 * @param {string} project - Project ID or project name
1792 * @param {string} buildUri - URI of the build that the runs used.
1793 * @param {string} owner - Team foundation ID of the owner of the runs.
1794 * @param {string} tmiRunId
1795 * @param {number} planId - ID of the test plan that the runs are a part of.
1796 * @param {boolean} includeRunDetails - If true, include all the properties of the runs.
1797 * @param {boolean} automated - If true, only returns automated runs.
1798 * @param {number} skip - Number of test runs to skip.
1799 * @param {number} top - Number of test runs to return.
1800 */
1801 getTestRuns(project, buildUri, owner, tmiRunId, planId, includeRunDetails, automated, skip, top) {
1802 return __awaiter(this, void 0, void 0, function* () {
1803 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1804 let routeValues = {
1805 project: project
1806 };
1807 let queryValues = {
1808 buildUri: buildUri,
1809 owner: owner,
1810 tmiRunId: tmiRunId,
1811 planId: planId,
1812 includeRunDetails: includeRunDetails,
1813 automated: automated,
1814 '$skip': skip,
1815 '$top': top,
1816 };
1817 try {
1818 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues);
1819 let url = verData.requestUrl;
1820 let options = this.createRequestOptions('application/json', verData.apiVersion);
1821 let res;
1822 res = yield this.rest.get(url, options);
1823 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, true);
1824 resolve(ret);
1825 }
1826 catch (err) {
1827 reject(err);
1828 }
1829 }));
1830 });
1831 }
1832 /**
1833 * Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate.
1834 *
1835 * @param {string} project - Project ID or project name
1836 * @param {Date} minLastUpdatedDate - Minimum Last Modified Date of run to be queried (Mandatory).
1837 * @param {Date} maxLastUpdatedDate - Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days).
1838 * @param {TestInterfaces.TestRunState} state - Current state of the Runs to be queried.
1839 * @param {number[]} planIds - Plan Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1840 * @param {boolean} isAutomated - Automation type of the Runs to be queried.
1841 * @param {TestInterfaces.TestRunPublishContext} publishContext - PublishContext of the Runs to be queried.
1842 * @param {number[]} buildIds - Build Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1843 * @param {number[]} buildDefIds - Build Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1844 * @param {string} branchName - Source Branch name of the Runs to be queried.
1845 * @param {number[]} releaseIds - Release Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1846 * @param {number[]} releaseDefIds - Release Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1847 * @param {number[]} releaseEnvIds - Release Environment Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1848 * @param {number[]} releaseEnvDefIds - Release Environment Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).
1849 * @param {string} runTitle - Run Title of the Runs to be queried.
1850 * @param {number} top - Number of runs to be queried. Limit is 100
1851 * @param {string} continuationToken - continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user.
1852 */
1853 queryTestRuns(project, minLastUpdatedDate, maxLastUpdatedDate, state, planIds, isAutomated, publishContext, buildIds, buildDefIds, branchName, releaseIds, releaseDefIds, releaseEnvIds, releaseEnvDefIds, runTitle, top, continuationToken) {
1854 return __awaiter(this, void 0, void 0, function* () {
1855 if (minLastUpdatedDate == null) {
1856 throw new TypeError('minLastUpdatedDate can not be null or undefined');
1857 }
1858 if (maxLastUpdatedDate == null) {
1859 throw new TypeError('maxLastUpdatedDate can not be null or undefined');
1860 }
1861 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1862 let routeValues = {
1863 project: project
1864 };
1865 let queryValues = {
1866 minLastUpdatedDate: minLastUpdatedDate,
1867 maxLastUpdatedDate: maxLastUpdatedDate,
1868 state: state,
1869 planIds: planIds && planIds.join(","),
1870 isAutomated: isAutomated,
1871 publishContext: publishContext,
1872 buildIds: buildIds && buildIds.join(","),
1873 buildDefIds: buildDefIds && buildDefIds.join(","),
1874 branchName: branchName,
1875 releaseIds: releaseIds && releaseIds.join(","),
1876 releaseDefIds: releaseDefIds && releaseDefIds.join(","),
1877 releaseEnvIds: releaseEnvIds && releaseEnvIds.join(","),
1878 releaseEnvDefIds: releaseEnvDefIds && releaseEnvDefIds.join(","),
1879 runTitle: runTitle,
1880 '$top': top,
1881 continuationToken: continuationToken,
1882 };
1883 try {
1884 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues);
1885 let url = verData.requestUrl;
1886 let options = this.createRequestOptions('application/json', verData.apiVersion);
1887 let res;
1888 res = yield this.rest.get(url, options);
1889 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, true);
1890 resolve(ret);
1891 }
1892 catch (err) {
1893 reject(err);
1894 }
1895 }));
1896 });
1897 }
1898 /**
1899 * Update test run by its ID.
1900 *
1901 * @param {TestInterfaces.RunUpdateModel} runUpdateModel - Run details RunUpdateModel
1902 * @param {string} project - Project ID or project name
1903 * @param {number} runId - ID of the run to update.
1904 */
1905 updateTestRun(runUpdateModel, project, runId) {
1906 return __awaiter(this, void 0, void 0, function* () {
1907 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1908 let routeValues = {
1909 project: project,
1910 runId: runId
1911 };
1912 try {
1913 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues);
1914 let url = verData.requestUrl;
1915 let options = this.createRequestOptions('application/json', verData.apiVersion);
1916 let res;
1917 res = yield this.rest.update(url, runUpdateModel, options);
1918 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false);
1919 resolve(ret);
1920 }
1921 catch (err) {
1922 reject(err);
1923 }
1924 }));
1925 });
1926 }
1927 /**
1928 * Create a test session
1929 *
1930 * @param {TestInterfaces.TestSession} testSession - Test session details for creation
1931 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1932 */
1933 createTestSession(testSession, teamContext) {
1934 return __awaiter(this, void 0, void 0, function* () {
1935 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1936 let project = null;
1937 let team = null;
1938 if (teamContext) {
1939 project = teamContext.projectId || teamContext.project;
1940 team = teamContext.teamId || teamContext.team;
1941 }
1942 let routeValues = {
1943 project: project,
1944 team: team
1945 };
1946 try {
1947 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues);
1948 let url = verData.requestUrl;
1949 let options = this.createRequestOptions('application/json', verData.apiVersion);
1950 let res;
1951 res = yield this.rest.create(url, testSession, options);
1952 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, false);
1953 resolve(ret);
1954 }
1955 catch (err) {
1956 reject(err);
1957 }
1958 }));
1959 });
1960 }
1961 /**
1962 * Get a list of test sessions
1963 *
1964 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1965 * @param {number} period - Period in days from now, for which test sessions are fetched.
1966 * @param {boolean} allSessions - If false, returns test sessions for current user. Otherwise, it returns test sessions for all users
1967 * @param {boolean} includeAllProperties - If true, it returns all properties of the test sessions. Otherwise, it returns the skinny version.
1968 * @param {TestInterfaces.TestSessionSource} source - Source of the test session.
1969 * @param {boolean} includeOnlyCompletedSessions - If true, it returns test sessions in completed state. Otherwise, it returns test sessions for all states
1970 */
1971 getTestSessions(teamContext, period, allSessions, includeAllProperties, source, includeOnlyCompletedSessions) {
1972 return __awaiter(this, void 0, void 0, function* () {
1973 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1974 let project = null;
1975 let team = null;
1976 if (teamContext) {
1977 project = teamContext.projectId || teamContext.project;
1978 team = teamContext.teamId || teamContext.team;
1979 }
1980 let routeValues = {
1981 project: project,
1982 team: team
1983 };
1984 let queryValues = {
1985 period: period,
1986 allSessions: allSessions,
1987 includeAllProperties: includeAllProperties,
1988 source: source,
1989 includeOnlyCompletedSessions: includeOnlyCompletedSessions,
1990 };
1991 try {
1992 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues, queryValues);
1993 let url = verData.requestUrl;
1994 let options = this.createRequestOptions('application/json', verData.apiVersion);
1995 let res;
1996 res = yield this.rest.get(url, options);
1997 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, true);
1998 resolve(ret);
1999 }
2000 catch (err) {
2001 reject(err);
2002 }
2003 }));
2004 });
2005 }
2006 /**
2007 * Update a test session
2008 *
2009 * @param {TestInterfaces.TestSession} testSession - Test session details for update
2010 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
2011 */
2012 updateTestSession(testSession, teamContext) {
2013 return __awaiter(this, void 0, void 0, function* () {
2014 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2015 let project = null;
2016 let team = null;
2017 if (teamContext) {
2018 project = teamContext.projectId || teamContext.project;
2019 team = teamContext.teamId || teamContext.team;
2020 }
2021 let routeValues = {
2022 project: project,
2023 team: team
2024 };
2025 try {
2026 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues);
2027 let url = verData.requestUrl;
2028 let options = this.createRequestOptions('application/json', verData.apiVersion);
2029 let res;
2030 res = yield this.rest.update(url, testSession, options);
2031 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, false);
2032 resolve(ret);
2033 }
2034 catch (err) {
2035 reject(err);
2036 }
2037 }));
2038 });
2039 }
2040 /**
2041 * @param {string} project - Project ID or project name
2042 * @param {number} sharedParameterId
2043 */
2044 deleteSharedParameter(project, sharedParameterId) {
2045 return __awaiter(this, void 0, void 0, function* () {
2046 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2047 let routeValues = {
2048 project: project,
2049 sharedParameterId: sharedParameterId
2050 };
2051 try {
2052 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8300eeca-0f8c-4eff-a089-d2dda409c41f", routeValues);
2053 let url = verData.requestUrl;
2054 let options = this.createRequestOptions('application/json', verData.apiVersion);
2055 let res;
2056 res = yield this.rest.del(url, options);
2057 let ret = this.formatResponse(res.result, null, false);
2058 resolve(ret);
2059 }
2060 catch (err) {
2061 reject(err);
2062 }
2063 }));
2064 });
2065 }
2066 /**
2067 * @param {string} project - Project ID or project name
2068 * @param {number} sharedStepId
2069 */
2070 deleteSharedStep(project, sharedStepId) {
2071 return __awaiter(this, void 0, void 0, function* () {
2072 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2073 let routeValues = {
2074 project: project,
2075 sharedStepId: sharedStepId
2076 };
2077 try {
2078 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "fabb3cc9-e3f8-40b7-8b62-24cc4b73fccf", routeValues);
2079 let url = verData.requestUrl;
2080 let options = this.createRequestOptions('application/json', verData.apiVersion);
2081 let res;
2082 res = yield this.rest.del(url, options);
2083 let ret = this.formatResponse(res.result, null, false);
2084 resolve(ret);
2085 }
2086 catch (err) {
2087 reject(err);
2088 }
2089 }));
2090 });
2091 }
2092 /**
2093 * Add test cases to suite.
2094 *
2095 * @param {string} project - Project ID or project name
2096 * @param {number} planId - ID of the test plan that contains the suite.
2097 * @param {number} suiteId - ID of the test suite to which the test cases must be added.
2098 * @param {string} testCaseIds - IDs of the test cases to add to the suite. Ids are specified in comma separated format.
2099 */
2100 addTestCasesToSuite(project, planId, suiteId, testCaseIds) {
2101 return __awaiter(this, void 0, void 0, function* () {
2102 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2103 let routeValues = {
2104 action: "TestCases",
2105 project: project,
2106 planId: planId,
2107 suiteId: suiteId,
2108 testCaseIds: testCaseIds
2109 };
2110 try {
2111 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues);
2112 let url = verData.requestUrl;
2113 let options = this.createRequestOptions('application/json', verData.apiVersion);
2114 let res;
2115 res = yield this.rest.create(url, null, options);
2116 let ret = this.formatResponse(res.result, null, true);
2117 resolve(ret);
2118 }
2119 catch (err) {
2120 reject(err);
2121 }
2122 }));
2123 });
2124 }
2125 /**
2126 * Get a specific test case in a test suite with test case id.
2127 *
2128 * @param {string} project - Project ID or project name
2129 * @param {number} planId - ID of the test plan that contains the suites.
2130 * @param {number} suiteId - ID of the suite that contains the test case.
2131 * @param {number} testCaseIds - ID of the test case to get.
2132 */
2133 getTestCaseById(project, planId, suiteId, testCaseIds) {
2134 return __awaiter(this, void 0, void 0, function* () {
2135 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2136 let routeValues = {
2137 action: "TestCases",
2138 project: project,
2139 planId: planId,
2140 suiteId: suiteId,
2141 testCaseIds: testCaseIds
2142 };
2143 try {
2144 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues);
2145 let url = verData.requestUrl;
2146 let options = this.createRequestOptions('application/json', verData.apiVersion);
2147 let res;
2148 res = yield this.rest.get(url, options);
2149 let ret = this.formatResponse(res.result, null, false);
2150 resolve(ret);
2151 }
2152 catch (err) {
2153 reject(err);
2154 }
2155 }));
2156 });
2157 }
2158 /**
2159 * Get all test cases in a suite.
2160 *
2161 * @param {string} project - Project ID or project name
2162 * @param {number} planId - ID of the test plan that contains the suites.
2163 * @param {number} suiteId - ID of the suite to get.
2164 */
2165 getTestCases(project, planId, suiteId) {
2166 return __awaiter(this, void 0, void 0, function* () {
2167 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2168 let routeValues = {
2169 action: "TestCases",
2170 project: project,
2171 planId: planId,
2172 suiteId: suiteId
2173 };
2174 try {
2175 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues);
2176 let url = verData.requestUrl;
2177 let options = this.createRequestOptions('application/json', verData.apiVersion);
2178 let res;
2179 res = yield this.rest.get(url, options);
2180 let ret = this.formatResponse(res.result, null, true);
2181 resolve(ret);
2182 }
2183 catch (err) {
2184 reject(err);
2185 }
2186 }));
2187 });
2188 }
2189 /**
2190 * The test points associated with the test cases are removed from the test suite. The test case work item is not deleted from the system. See test cases resource to delete a test case permanently.
2191 *
2192 * @param {string} project - Project ID or project name
2193 * @param {number} planId - ID of the test plan that contains the suite.
2194 * @param {number} suiteId - ID of the suite to get.
2195 * @param {string} testCaseIds - IDs of the test cases to remove from the suite.
2196 */
2197 removeTestCasesFromSuiteUrl(project, planId, suiteId, testCaseIds) {
2198 return __awaiter(this, void 0, void 0, function* () {
2199 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2200 let routeValues = {
2201 action: "TestCases",
2202 project: project,
2203 planId: planId,
2204 suiteId: suiteId,
2205 testCaseIds: testCaseIds
2206 };
2207 try {
2208 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues);
2209 let url = verData.requestUrl;
2210 let options = this.createRequestOptions('application/json', verData.apiVersion);
2211 let res;
2212 res = yield this.rest.del(url, options);
2213 let ret = this.formatResponse(res.result, null, false);
2214 resolve(ret);
2215 }
2216 catch (err) {
2217 reject(err);
2218 }
2219 }));
2220 });
2221 }
2222 /**
2223 * Updates the properties of the test case association in a suite.
2224 *
2225 * @param {TestInterfaces.SuiteTestCaseUpdateModel} suiteTestCaseUpdateModel - Model for updation of the properties of test case suite association.
2226 * @param {string} project - Project ID or project name
2227 * @param {number} planId - ID of the test plan that contains the suite.
2228 * @param {number} suiteId - ID of the test suite to which the test cases must be added.
2229 * @param {string} testCaseIds - IDs of the test cases to add to the suite. Ids are specified in comma separated format.
2230 */
2231 updateSuiteTestCases(suiteTestCaseUpdateModel, project, planId, suiteId, testCaseIds) {
2232 return __awaiter(this, void 0, void 0, function* () {
2233 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2234 let routeValues = {
2235 action: "TestCases",
2236 project: project,
2237 planId: planId,
2238 suiteId: suiteId,
2239 testCaseIds: testCaseIds
2240 };
2241 try {
2242 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues);
2243 let url = verData.requestUrl;
2244 let options = this.createRequestOptions('application/json', verData.apiVersion);
2245 let res;
2246 res = yield this.rest.update(url, suiteTestCaseUpdateModel, options);
2247 let ret = this.formatResponse(res.result, null, true);
2248 resolve(ret);
2249 }
2250 catch (err) {
2251 reject(err);
2252 }
2253 }));
2254 });
2255 }
2256 /**
2257 * Delete a test case.
2258 *
2259 * @param {string} project - Project ID or project name
2260 * @param {number} testCaseId - Id of test case to delete.
2261 */
2262 deleteTestCase(project, testCaseId) {
2263 return __awaiter(this, void 0, void 0, function* () {
2264 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2265 let routeValues = {
2266 project: project,
2267 testCaseId: testCaseId
2268 };
2269 try {
2270 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4d472e0f-e32c-4ef8-adf4-a4078772889c", routeValues);
2271 let url = verData.requestUrl;
2272 let options = this.createRequestOptions('application/json', verData.apiVersion);
2273 let res;
2274 res = yield this.rest.del(url, options);
2275 let ret = this.formatResponse(res.result, null, false);
2276 resolve(ret);
2277 }
2278 catch (err) {
2279 reject(err);
2280 }
2281 }));
2282 });
2283 }
2284 /**
2285 * Get history of a test method using TestHistoryQuery
2286 *
2287 * @param {TestInterfaces.TestHistoryQuery} filter - TestHistoryQuery to get history
2288 * @param {string} project - Project ID or project name
2289 */
2290 queryTestHistory(filter, project) {
2291 return __awaiter(this, void 0, void 0, function* () {
2292 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2293 let routeValues = {
2294 project: project
2295 };
2296 try {
2297 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "929fd86c-3e38-4d8c-b4b6-90df256e5971", routeValues);
2298 let url = verData.requestUrl;
2299 let options = this.createRequestOptions('application/json', verData.apiVersion);
2300 let res;
2301 res = yield this.rest.create(url, filter, options);
2302 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestHistoryQuery, false);
2303 resolve(ret);
2304 }
2305 catch (err) {
2306 reject(err);
2307 }
2308 }));
2309 });
2310 }
2311 /**
2312 * @param {TestInterfaces.TestSettings} testSettings
2313 * @param {string} project - Project ID or project name
2314 */
2315 createTestSettings(testSettings, project) {
2316 return __awaiter(this, void 0, void 0, function* () {
2317 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2318 let routeValues = {
2319 project: project
2320 };
2321 try {
2322 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues);
2323 let url = verData.requestUrl;
2324 let options = this.createRequestOptions('application/json', verData.apiVersion);
2325 let res;
2326 res = yield this.rest.create(url, testSettings, options);
2327 let ret = this.formatResponse(res.result, null, false);
2328 resolve(ret);
2329 }
2330 catch (err) {
2331 reject(err);
2332 }
2333 }));
2334 });
2335 }
2336 /**
2337 * @param {string} project - Project ID or project name
2338 * @param {number} testSettingsId
2339 */
2340 deleteTestSettings(project, testSettingsId) {
2341 return __awaiter(this, void 0, void 0, function* () {
2342 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2343 let routeValues = {
2344 project: project,
2345 testSettingsId: testSettingsId
2346 };
2347 try {
2348 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues);
2349 let url = verData.requestUrl;
2350 let options = this.createRequestOptions('application/json', verData.apiVersion);
2351 let res;
2352 res = yield this.rest.del(url, options);
2353 let ret = this.formatResponse(res.result, null, false);
2354 resolve(ret);
2355 }
2356 catch (err) {
2357 reject(err);
2358 }
2359 }));
2360 });
2361 }
2362 /**
2363 * @param {string} project - Project ID or project name
2364 * @param {number} testSettingsId
2365 */
2366 getTestSettingsById(project, testSettingsId) {
2367 return __awaiter(this, void 0, void 0, function* () {
2368 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2369 let routeValues = {
2370 project: project,
2371 testSettingsId: testSettingsId
2372 };
2373 try {
2374 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues);
2375 let url = verData.requestUrl;
2376 let options = this.createRequestOptions('application/json', verData.apiVersion);
2377 let res;
2378 res = yield this.rest.get(url, options);
2379 let ret = this.formatResponse(res.result, null, false);
2380 resolve(ret);
2381 }
2382 catch (err) {
2383 reject(err);
2384 }
2385 }));
2386 });
2387 }
2388 /**
2389 * @param {TestInterfaces.WorkItemToTestLinks} workItemToTestLinks
2390 * @param {string} project - Project ID or project name
2391 */
2392 addWorkItemToTestLinks(workItemToTestLinks, project) {
2393 return __awaiter(this, void 0, void 0, function* () {
2394 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2395 let routeValues = {
2396 project: project
2397 };
2398 try {
2399 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "371b1655-ce05-412e-a113-64cc77bb78d2", routeValues);
2400 let url = verData.requestUrl;
2401 let options = this.createRequestOptions('application/json', verData.apiVersion);
2402 let res;
2403 res = yield this.rest.create(url, workItemToTestLinks, options);
2404 let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.WorkItemToTestLinks, false);
2405 resolve(ret);
2406 }
2407 catch (err) {
2408 reject(err);
2409 }
2410 }));
2411 });
2412 }
2413 /**
2414 * @param {string} project - Project ID or project name
2415 * @param {string} testName
2416 * @param {number} workItemId
2417 */
2418 deleteTestMethodToWorkItemLink(project, testName, workItemId) {
2419 return __awaiter(this, void 0, void 0, function* () {
2420 if (testName == null) {
2421 throw new TypeError('testName can not be null or undefined');
2422 }
2423 if (workItemId == null) {
2424 throw new TypeError('workItemId can not be null or undefined');
2425 }
2426 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2427 let routeValues = {
2428 project: project
2429 };
2430 let queryValues = {
2431 testName: testName,
2432 workItemId: workItemId,
2433 };
2434 try {
2435 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "7b0bdee3-a354-47f9-a42c-89018d7808d5", routeValues, queryValues);
2436 let url = verData.requestUrl;
2437 let options = this.createRequestOptions('application/json', verData.apiVersion);
2438 let res;
2439 res = yield this.rest.del(url, options);
2440 let ret = this.formatResponse(res.result, null, false);
2441 resolve(ret);
2442 }
2443 catch (err) {
2444 reject(err);
2445 }
2446 }));
2447 });
2448 }
2449 /**
2450 * @param {string} project - Project ID or project name
2451 * @param {string} testName
2452 */
2453 queryTestMethodLinkedWorkItems(project, testName) {
2454 return __awaiter(this, void 0, void 0, function* () {
2455 if (testName == null) {
2456 throw new TypeError('testName can not be null or undefined');
2457 }
2458 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2459 let routeValues = {
2460 project: project
2461 };
2462 let queryValues = {
2463 testName: testName,
2464 };
2465 try {
2466 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "7b0bdee3-a354-47f9-a42c-89018d7808d5", routeValues, queryValues);
2467 let url = verData.requestUrl;
2468 let options = this.createRequestOptions('application/json', verData.apiVersion);
2469 let res;
2470 res = yield this.rest.create(url, null, options);
2471 let ret = this.formatResponse(res.result, null, false);
2472 resolve(ret);
2473 }
2474 catch (err) {
2475 reject(err);
2476 }
2477 }));
2478 });
2479 }
2480 /**
2481 * @param {string} project - Project ID or project name
2482 * @param {string} workItemCategory
2483 * @param {string} automatedTestName
2484 * @param {number} testCaseId
2485 * @param {Date} maxCompleteDate
2486 * @param {number} days
2487 * @param {number} workItemCount
2488 */
2489 queryTestResultWorkItems(project, workItemCategory, automatedTestName, testCaseId, maxCompleteDate, days, workItemCount) {
2490 return __awaiter(this, void 0, void 0, function* () {
2491 if (workItemCategory == null) {
2492 throw new TypeError('workItemCategory can not be null or undefined');
2493 }
2494 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2495 let routeValues = {
2496 project: project
2497 };
2498 let queryValues = {
2499 workItemCategory: workItemCategory,
2500 automatedTestName: automatedTestName,
2501 testCaseId: testCaseId,
2502 maxCompleteDate: maxCompleteDate,
2503 days: days,
2504 '$workItemCount': workItemCount,
2505 };
2506 try {
2507 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "926ff5dc-137f-45f0-bd51-9412fa9810ce", routeValues, queryValues);
2508 let url = verData.requestUrl;
2509 let options = this.createRequestOptions('application/json', verData.apiVersion);
2510 let res;
2511 res = yield this.rest.get(url, options);
2512 let ret = this.formatResponse(res.result, null, true);
2513 resolve(ret);
2514 }
2515 catch (err) {
2516 reject(err);
2517 }
2518 }));
2519 });
2520 }
2521}
2522exports.TestApi = TestApi;
2523TestApi.RESOURCE_AREA_ID = "c2aa639c-3ccc-4740-b3b6-ce2a1e1d984e";