Skip to content

Commit e60c681

Browse files
Adding testplan api in node sdk (#577)
1 parent d0bbdea commit e60c681

File tree

8 files changed

+2215
-8
lines changed

8 files changed

+2215
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ These clients are available:
7171
* TaskAgent
7272
* Task
7373
* Test
74+
* TestPlan
7475
* TestResults
7576
* Tfvc
7677
* Wiki

api/TestPlanApi.ts

Lines changed: 2169 additions & 0 deletions
Large diffs are not rendered by default.

api/WebApi.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import securityrolesm = require('./SecurityRolesApi');
2121
import taskagentm = require('./TaskAgentApi');
2222
import taskm = require('./TaskApi');
2323
import testm = require('./TestApi');
24+
import testplanm = require('./TestPlanApi')
2425
import testresultsm = require('./TestResultsApi');
2526
import tfvcm = require('./TfvcApi');
2627
import wikim = require('./WikiApi');
@@ -318,7 +319,14 @@ export class WebApi {
318319
return new testm.TestApi(serverUrl, handlers, this.options);
319320
}
320321

321-
public async getTestResultsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testresultsm.ITestResultsApi> {
322+
public async getTestPlanApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testplanm.ITestPlanApi> {
323+
// TODO: Load RESOURCE_AREA_ID correctly.
324+
serverUrl = await this._getResourceAreaUrl(serverUrl || this.serverUrl, "e4c27205-9d23-4c98-b958-d798bc3f9cd4");
325+
handlers = handlers || [this.authHandler];
326+
return new testplanm.TestPlanApi(serverUrl, handlers, this.options);
327+
}
328+
329+
public async getTestResultsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testresultsm.ITestResultsApi> {
322330
// TODO: Load RESOURCE_AREA_ID correctly.
323331
serverUrl = await this._getResourceAreaUrl(serverUrl || this.serverUrl, "c83eaf52-edf3-4034-ae11-17d38f25404c");
324332
handlers = handlers || [this.authHandler];
@@ -422,7 +430,7 @@ export class WebApi {
422430
}
423431

424432
private _readTaskLibSecrets(lookupKey: string): string {
425-
if(isBrowser) {
433+
if (isBrowser) {
426434
throw new Error("Browsers can't securely keep secrets");
427435
}
428436
// the lookupKey should has following format

api/interfaces/TestPlanInterfaces.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* ---------------------------------------------------------
33
* Copyright(C) Microsoft Corporation. All rights reserved.
44
* ---------------------------------------------------------
@@ -10,7 +10,7 @@
1010

1111
"use strict";
1212

13-
import TFS_TestManagement_Contracts = require("../TFS/TestManagement/Contracts");
13+
import TFS_TestManagement_Contracts = require("../interfaces/TestInterfaces");
1414
import TfsCoreInterfaces = require("../interfaces/CoreInterfaces");
1515
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
1616

@@ -248,6 +248,24 @@ export enum ExcludeFlags {
248248
ExtraInformation = 2,
249249
}
250250

251+
/**
252+
* Parameters for test case export operation
253+
*/
254+
export interface ExportTestCaseParams {
255+
/**
256+
* Test Case IDs to exported
257+
*/
258+
testCaseIds: number[];
259+
/**
260+
* ID of test plan containing test cases
261+
*/
262+
testPlanId: number;
263+
/**
264+
* ID of test suite containing test cases
265+
*/
266+
testSuiteId: number;
267+
}
268+
251269
export enum FailureType {
252270
None = 0,
253271
Regression = 1,
@@ -916,10 +934,10 @@ export interface TestPlanReference {
916934
*/
917935
export interface TestPlansHubRefreshData {
918936
defineColumnOptionFields?: string[];
919-
defineTabCustomColumnFieldMap?: { [key: string] : string; };
937+
defineTabCustomColumnFieldMap?: { [key: string]: string; };
920938
errorMessage?: string;
921939
executeColumnOptionFields?: string[];
922-
executeTabCustomColumnFieldMap?: { [key: string] : string; };
940+
executeTabCustomColumnFieldMap?: { [key: string]: string; };
923941
isAdvancedExtensionEnabled?: boolean;
924942
selectedPivotId?: string;
925943
selectedSuiteId?: number;

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-devops-node-api",
33
"description": "Node client for Azure DevOps and TFS REST APIs",
4-
"version": "12.1.1",
4+
"version": "12.2.0",
55
"main": "./WebApi.js",
66
"types": "./WebApi.d.ts",
77
"scripts": {

samples/creation.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { RequestedExtension } from "azure-devops-node-api/interfaces/ExtensionMa
1515
import { SecurityRole } from "azure-devops-node-api/interfaces/SecurityRolesInterfaces";
1616
import { TaskAgentPool } from "azure-devops-node-api/interfaces/TaskAgentInterfaces";
1717
import { TestRun } from "azure-devops-node-api/interfaces/TestInterfaces";
18+
import { TestPlan } from "azure-devops-node-api/interfaces/TestPlanInterfaces";
1819
import { Timeline as TaskAgentTimeline } from "azure-devops-node-api/interfaces/TaskAgentInterfaces";
1920
import { WebApiTeam } from "azure-devops-node-api/interfaces/CoreInterfaces";
2021
import { WidgetScope, WidgetTypesResponse } from "azure-devops-node-api/interfaces/DashboardInterfaces";
@@ -202,6 +203,15 @@ export async function run() {
202203
console.log(`found ${runs.length} test runs`);
203204
}
204205

206+
/********** TestPlan **********/
207+
printSectionStart('TestPlan');
208+
const testPlanApi = await vstsCollectionLevel.getTestPlanApi();
209+
const testPlans: TestPlan[] = await testPlanApi.getTestPlans(common.getProject());
210+
211+
if (testPlans) {
212+
console.log(`found ${testPlans.length} test plans`);
213+
}
214+
205215
/********** TestResults **********/
206216
printSectionStart('TestResults');
207217
const testResultsApi = await vstsCollectionLevel.getTestResultsApi();

samples/samples.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"release",
1313
"task",
1414
"test",
15+
"testPlan",
1516
"testResults",
1617
"wiki",
1718
"work",

0 commit comments

Comments
 (0)