Skip to content

Commit

Permalink
Adding testplan api in node sdk (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
triptijain2112 committed Jan 11, 2024
1 parent d0bbdea commit e60c681
Show file tree
Hide file tree
Showing 8 changed files with 2,215 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ These clients are available:
* TaskAgent
* Task
* Test
* TestPlan
* TestResults
* Tfvc
* Wiki
Expand Down
2,169 changes: 2,169 additions & 0 deletions api/TestPlanApi.ts

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions api/WebApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import securityrolesm = require('./SecurityRolesApi');
import taskagentm = require('./TaskAgentApi');
import taskm = require('./TaskApi');
import testm = require('./TestApi');
import testplanm = require('./TestPlanApi')
import testresultsm = require('./TestResultsApi');
import tfvcm = require('./TfvcApi');
import wikim = require('./WikiApi');
Expand Down Expand Up @@ -318,7 +319,14 @@ export class WebApi {
return new testm.TestApi(serverUrl, handlers, this.options);
}

public async getTestResultsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testresultsm.ITestResultsApi> {
public async getTestPlanApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testplanm.ITestPlanApi> {
// TODO: Load RESOURCE_AREA_ID correctly.
serverUrl = await this._getResourceAreaUrl(serverUrl || this.serverUrl, "e4c27205-9d23-4c98-b958-d798bc3f9cd4");
handlers = handlers || [this.authHandler];
return new testplanm.TestPlanApi(serverUrl, handlers, this.options);
}

public async getTestResultsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<testresultsm.ITestResultsApi> {
// TODO: Load RESOURCE_AREA_ID correctly.
serverUrl = await this._getResourceAreaUrl(serverUrl || this.serverUrl, "c83eaf52-edf3-4034-ae11-17d38f25404c");
handlers = handlers || [this.authHandler];
Expand Down Expand Up @@ -422,7 +430,7 @@ export class WebApi {
}

private _readTaskLibSecrets(lookupKey: string): string {
if(isBrowser) {
if (isBrowser) {
throw new Error("Browsers can't securely keep secrets");
}
// the lookupKey should has following format
Expand Down
26 changes: 22 additions & 4 deletions api/interfaces/TestPlanInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
Expand All @@ -10,7 +10,7 @@

"use strict";

import TFS_TestManagement_Contracts = require("../TFS/TestManagement/Contracts");
import TFS_TestManagement_Contracts = require("../interfaces/TestInterfaces");
import TfsCoreInterfaces = require("../interfaces/CoreInterfaces");
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");

Expand Down Expand Up @@ -248,6 +248,24 @@ export enum ExcludeFlags {
ExtraInformation = 2,
}

/**
* Parameters for test case export operation
*/
export interface ExportTestCaseParams {
/**
* Test Case IDs to exported
*/
testCaseIds: number[];
/**
* ID of test plan containing test cases
*/
testPlanId: number;
/**
* ID of test suite containing test cases
*/
testSuiteId: number;
}

export enum FailureType {
None = 0,
Regression = 1,
Expand Down Expand Up @@ -916,10 +934,10 @@ export interface TestPlanReference {
*/
export interface TestPlansHubRefreshData {
defineColumnOptionFields?: string[];
defineTabCustomColumnFieldMap?: { [key: string] : string; };
defineTabCustomColumnFieldMap?: { [key: string]: string; };
errorMessage?: string;
executeColumnOptionFields?: string[];
executeTabCustomColumnFieldMap?: { [key: string] : string; };
executeTabCustomColumnFieldMap?: { [key: string]: string; };
isAdvancedExtensionEnabled?: boolean;
selectedPivotId?: string;
selectedSuiteId?: number;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "azure-devops-node-api",
"description": "Node client for Azure DevOps and TFS REST APIs",
"version": "12.1.1",
"version": "12.2.0",
"main": "./WebApi.js",
"types": "./WebApi.d.ts",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions samples/creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { RequestedExtension } from "azure-devops-node-api/interfaces/ExtensionMa
import { SecurityRole } from "azure-devops-node-api/interfaces/SecurityRolesInterfaces";
import { TaskAgentPool } from "azure-devops-node-api/interfaces/TaskAgentInterfaces";
import { TestRun } from "azure-devops-node-api/interfaces/TestInterfaces";
import { TestPlan } from "azure-devops-node-api/interfaces/TestPlanInterfaces";
import { Timeline as TaskAgentTimeline } from "azure-devops-node-api/interfaces/TaskAgentInterfaces";
import { WebApiTeam } from "azure-devops-node-api/interfaces/CoreInterfaces";
import { WidgetScope, WidgetTypesResponse } from "azure-devops-node-api/interfaces/DashboardInterfaces";
Expand Down Expand Up @@ -202,6 +203,15 @@ export async function run() {
console.log(`found ${runs.length} test runs`);
}

/********** TestPlan **********/
printSectionStart('TestPlan');
const testPlanApi = await vstsCollectionLevel.getTestPlanApi();
const testPlans: TestPlan[] = await testPlanApi.getTestPlans(common.getProject());

if (testPlans) {
console.log(`found ${testPlans.length} test plans`);
}

/********** TestResults **********/
printSectionStart('TestResults');
const testResultsApi = await vstsCollectionLevel.getTestResultsApi();
Expand Down
1 change: 1 addition & 0 deletions samples/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"release",
"task",
"test",
"testPlan",
"testResults",
"wiki",
"work",
Expand Down

0 comments on commit e60c681

Please sign in to comment.