Added testresults client for TCM (#555)

* added testresults client

* Updated package.json

* updated package version to 12.1.0
This commit is contained in:
triptijain2112 2023-06-20 14:09:59 +05:30 коммит произвёл GitHub
Родитель edb8646a1d
Коммит 55908ae28d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 5274 добавлений и 1 удалений

Просмотреть файл

@ -71,6 +71,7 @@ These clients are available:
* TaskAgent
* Task
* Test
* TestResults
* Tfvc
* Wiki
* Work

5201
api/TestResultsApi.ts Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -21,6 +21,7 @@ import securityrolesm = require('./SecurityRolesApi');
import taskagentm = require('./TaskAgentApi');
import taskm = require('./TaskApi');
import testm = require('./TestApi');
import testresultsm = require('./TestResultsApi');
import tfvcm = require('./TfvcApi');
import wikim = require('./WikiApi');
import workm = require('./WorkApi');
@ -317,6 +318,13 @@ export class WebApi {
return new testm.TestApi(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];
return new testresultsm.TestResultsApi(serverUrl, handlers, this.options);
}
public async getTfvcApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): Promise<tfvcm.ITfvcApi> {
// TODO: Load RESOURCE_AREA_ID correctly.
serverUrl = await this._getResourceAreaUrl(serverUrl || this.serverUrl, "8aa40520-446d-40e6-89f6-9c9f9ce44c48");

Просмотреть файл

@ -3891,6 +3891,30 @@ export interface TestResultFailuresAnalysis {
newFailures?: TestFailureDetails;
}
/**
* The test failure type resource
*/
export interface TestResultFailureType {
/**
* ID of the test failure type
*/
id: number;
/**
* Name of the test failure type
*/
name: string;
}
/**
* The test failure type request model
*/
export interface TestResultFailureTypeRequestModel {
/**
* Name of the test failure type
*/
name: string;
}
/**
* Group by for results
*/

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "azure-devops-node-api",
"description": "Node client for Azure DevOps and TFS REST APIs",
"version": "12.0.0",
"version": "12.1.0",
"main": "./WebApi.js",
"types": "./WebApi.d.ts",
"scripts": {

Просмотреть файл

@ -202,6 +202,15 @@ export async function run() {
console.log(`found ${runs.length} test runs`);
}
/********** TestResults **********/
printSectionStart('TestResults');
const testResultsApi = await vstsCollectionLevel.getTestResultsApi();
const testRuns: TestRun[] = await testResultsApi.getTestRuns(common.getProject());
if (testRuns) {
console.log(`found ${testRuns.length} test runs`);
}
/********** Tfvc **********/
printSectionStart("Tfvc");
const tfvcApi = await vstsCollectionLevel.getTfvcApi();

Просмотреть файл

@ -12,6 +12,7 @@
"release",
"task",
"test",
"testResults",
"wiki",
"work",
"workItemTracking"

28
samples/testResults.ts Normal file
Просмотреть файл

@ -0,0 +1,28 @@
import * as common from './common';
import * as nodeApi from 'azure-devops-node-api';
import * as BuildApi from 'azure-devops-node-api/BuildApi';
import * as CoreApi from 'azure-devops-node-api/CoreApi';
import * as TestResultsApi from 'azure-devops-node-api/TestResultsApi';
import * as BuildInterfaces from 'azure-devops-node-api/interfaces/BuildInterfaces';
import * as CoreInterfaces from 'azure-devops-node-api/interfaces/CoreInterfaces';
import * as TestInterfaces from 'azure-devops-node-api/interfaces/TestInterfaces';
export async function run(createdProjectId: string) {
const projectId: string = common.getProject();
const webApi: nodeApi.WebApi = await common.getWebApi();
const testResultsApiObject: TestResultsApi.ITestResultsApi = await webApi.getTestResultsApi();
const coreApiObject: CoreApi.CoreApi = await webApi.getCoreApi();
const project: CoreInterfaces.TeamProject = await coreApiObject.getProject(projectId);
common.banner('Testing Samples');
common.heading('Get test suite runs');
const runs: TestInterfaces.TestRun[] = await testResultsApiObject.getTestRuns(projectId);
console.log('Current Runs:', runs);
common.heading('Get code coverage');
const buildApiObject: BuildApi.IBuildApi = await webApi.getBuildApi();
const defs: BuildInterfaces.DefinitionReference[] = await buildApiObject.getDefinitions(projectId);
console.log('Code coverage for build' + defs[0].id + ':', await testResultsApiObject.getCodeCoverageSummary(projectId, defs[0].id));
}

Просмотреть файл

@ -19,6 +19,7 @@
"release.ts",
"task.ts",
"test.ts",
"testResults.ts",
"wiki.ts",
"work.ts",
"workItemTracking.ts"