@elisra-devops/docgen-data-provider 1.89.0 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/models/mewp-reporting.d.ts +0 -4
- package/bin/modules/ResultDataProvider.d.ts +2 -3
- package/bin/modules/ResultDataProvider.js +11 -90
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/package.json +1 -1
- package/src/models/mewp-reporting.ts +0 -5
- package/src/modules/ResultDataProvider.ts +4 -100
|
@@ -13,10 +13,6 @@ export interface MewpExternalFileRef {
|
|
|
13
13
|
export interface MewpCoverageRequestOptions {
|
|
14
14
|
externalBugsFile?: MewpExternalFileRef | null;
|
|
15
15
|
externalL3L4File?: MewpExternalFileRef | null;
|
|
16
|
-
debugMode?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface MewpInternalValidationRequestOptions {
|
|
19
|
-
debugMode?: boolean;
|
|
20
16
|
}
|
|
21
17
|
export interface MewpRequirementStepSummary {
|
|
22
18
|
passed: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenPcrRequest } from '../models/tfs-data';
|
|
2
|
-
import type { MewpCoverageFlatPayload, MewpExternalFilesValidationResponse, MewpCoverageRequestOptions, MewpExternalFileRef, MewpInternalValidationFlatPayload
|
|
2
|
+
import type { MewpCoverageFlatPayload, MewpExternalFilesValidationResponse, MewpCoverageRequestOptions, MewpExternalFileRef, MewpInternalValidationFlatPayload } from '../models/mewp-reporting';
|
|
3
3
|
/**
|
|
4
4
|
* Provides methods to fetch, process, and summarize test data from Azure DevOps.
|
|
5
5
|
*
|
|
@@ -70,7 +70,7 @@ export default class ResultDataProvider {
|
|
|
70
70
|
* Rows are one Requirement-TestCase pair; uncovered requirements are emitted with empty test-case columns.
|
|
71
71
|
*/
|
|
72
72
|
getMewpL2CoverageFlatResults(testPlanId: string, projectName: string, selectedSuiteIds: number[] | undefined, linkedQueryRequest?: any, options?: MewpCoverageRequestOptions): Promise<MewpCoverageFlatPayload>;
|
|
73
|
-
getMewpInternalValidationFlatResults(testPlanId: string, projectName: string, selectedSuiteIds: number[] | undefined, linkedQueryRequest?: any
|
|
73
|
+
getMewpInternalValidationFlatResults(testPlanId: string, projectName: string, selectedSuiteIds: number[] | undefined, linkedQueryRequest?: any): Promise<MewpInternalValidationFlatPayload>;
|
|
74
74
|
validateMewpExternalFiles(options: {
|
|
75
75
|
externalBugsFile?: MewpExternalFileRef | null;
|
|
76
76
|
externalL3L4File?: MewpExternalFileRef | null;
|
|
@@ -237,7 +237,6 @@ export default class ResultDataProvider {
|
|
|
237
237
|
* @returns A promise that resolves to the result data.
|
|
238
238
|
*/
|
|
239
239
|
private fetchResultDataBasedOnWi;
|
|
240
|
-
private logMewpRunScenarioDebugMatrix;
|
|
241
240
|
/**
|
|
242
241
|
* Converts a run status string into a human-readable format.
|
|
243
242
|
*
|
|
@@ -348,9 +348,6 @@ class ResultDataProvider {
|
|
|
348
348
|
const parsedDefinitionStepsByTestCase = new Map();
|
|
349
349
|
const testCaseStepsXmlMap = this.buildTestCaseStepsXmlMap(testData);
|
|
350
350
|
const runResults = await this.fetchAllResultDataTestReporter(testData, projectName, [], false, false);
|
|
351
|
-
if (options === null || options === void 0 ? void 0 : options.debugMode) {
|
|
352
|
-
this.logMewpRunScenarioDebugMatrix(runResults, `coverage plan=${testPlanId}`);
|
|
353
|
-
}
|
|
354
351
|
for (const runResult of runResults) {
|
|
355
352
|
const testCaseId = this.extractMewpTestCaseId(runResult);
|
|
356
353
|
const rawActionResults = Array.isArray((_j = runResult === null || runResult === void 0 ? void 0 : runResult.iteration) === null || _j === void 0 ? void 0 : _j.actionResults)
|
|
@@ -478,7 +475,7 @@ class ResultDataProvider {
|
|
|
478
475
|
return defaultPayload;
|
|
479
476
|
}
|
|
480
477
|
}
|
|
481
|
-
async getMewpInternalValidationFlatResults(testPlanId, projectName, selectedSuiteIds, linkedQueryRequest
|
|
478
|
+
async getMewpInternalValidationFlatResults(testPlanId, projectName, selectedSuiteIds, linkedQueryRequest) {
|
|
482
479
|
var _a, _b, _c;
|
|
483
480
|
const defaultPayload = {
|
|
484
481
|
sheetName: `MEWP Internal Validation - Plan ${testPlanId}`,
|
|
@@ -515,10 +512,6 @@ class ResultDataProvider {
|
|
|
515
512
|
logger_1.default.info(`MEWP internal validation steps source summary: testCases=${allTestCaseIds.size} ` +
|
|
516
513
|
`fromSuitePayload=${preloadedStepXmlCount} fromWorkItemFallback=${fallbackStepLoadStats.loadedFromFallback} ` +
|
|
517
514
|
`stepsXmlAvailable=${stepsXmlByTestCase.size} unresolved=${fallbackStepLoadStats.unresolvedCount}`);
|
|
518
|
-
if (options === null || options === void 0 ? void 0 : options.debugMode) {
|
|
519
|
-
const debugRunResults = await this.fetchAllResultDataTestReporter(testData, projectName, [], false, false);
|
|
520
|
-
this.logMewpRunScenarioDebugMatrix(debugRunResults, `internal-validation plan=${testPlanId}`);
|
|
521
|
-
}
|
|
522
515
|
const validL2BaseKeys = new Set([...requirementFamilies.keys()]);
|
|
523
516
|
const diagnostics = {
|
|
524
517
|
totalTestCases: 0,
|
|
@@ -3164,71 +3157,6 @@ class ResultDataProvider {
|
|
|
3164
3157
|
async fetchResultDataBasedOnWi(projectName, runId, resultId) {
|
|
3165
3158
|
return this.fetchResultDataBasedOnWiBase(projectName, runId, resultId);
|
|
3166
3159
|
}
|
|
3167
|
-
logMewpRunScenarioDebugMatrix(runResults, contextLabel) {
|
|
3168
|
-
var _a, _b;
|
|
3169
|
-
const results = Array.isArray(runResults) ? runResults : [];
|
|
3170
|
-
const matrix = {
|
|
3171
|
-
total: results.length,
|
|
3172
|
-
passOrFailWithActionResults: 0,
|
|
3173
|
-
runWithNoActionResults: 0,
|
|
3174
|
-
notApplicable: 0,
|
|
3175
|
-
noRunHistoryActive: 0,
|
|
3176
|
-
other: 0,
|
|
3177
|
-
};
|
|
3178
|
-
const samples = {
|
|
3179
|
-
passOrFailWithActionResults: [],
|
|
3180
|
-
runWithNoActionResults: [],
|
|
3181
|
-
notApplicable: [],
|
|
3182
|
-
noRunHistoryActive: [],
|
|
3183
|
-
other: [],
|
|
3184
|
-
};
|
|
3185
|
-
const pushSample = (bucket, id) => {
|
|
3186
|
-
if (!Number.isFinite(id) || id <= 0)
|
|
3187
|
-
return;
|
|
3188
|
-
if (samples[bucket].length >= 5)
|
|
3189
|
-
return;
|
|
3190
|
-
samples[bucket].push(id);
|
|
3191
|
-
};
|
|
3192
|
-
for (const item of results) {
|
|
3193
|
-
const testCaseId = Number((item === null || item === void 0 ? void 0 : item.testCaseId) || ((_a = item === null || item === void 0 ? void 0 : item.testCase) === null || _a === void 0 ? void 0 : _a.id) || 0);
|
|
3194
|
-
const hasRun = Number((item === null || item === void 0 ? void 0 : item.lastRunId) || 0) > 0 && Number((item === null || item === void 0 ? void 0 : item.lastResultId) || 0) > 0;
|
|
3195
|
-
const rawOutcome = String((item === null || item === void 0 ? void 0 : item._debugTestOutcome) || '').trim().toLowerCase();
|
|
3196
|
-
const rawState = String((item === null || item === void 0 ? void 0 : item._debugTestCaseState) || '').trim().toLowerCase();
|
|
3197
|
-
const originalActionResultsCount = Number((_b = item === null || item === void 0 ? void 0 : item._debugOriginalActionResultsCount) !== null && _b !== void 0 ? _b : -1);
|
|
3198
|
-
if (rawOutcome === 'notapplicable' || rawOutcome === 'not applicable') {
|
|
3199
|
-
matrix.notApplicable += 1;
|
|
3200
|
-
pushSample('notApplicable', testCaseId);
|
|
3201
|
-
continue;
|
|
3202
|
-
}
|
|
3203
|
-
if (hasRun && (rawOutcome === 'passed' || rawOutcome === 'failed') && originalActionResultsCount > 0) {
|
|
3204
|
-
matrix.passOrFailWithActionResults += 1;
|
|
3205
|
-
pushSample('passOrFailWithActionResults', testCaseId);
|
|
3206
|
-
continue;
|
|
3207
|
-
}
|
|
3208
|
-
if (hasRun && originalActionResultsCount === 0) {
|
|
3209
|
-
matrix.runWithNoActionResults += 1;
|
|
3210
|
-
pushSample('runWithNoActionResults', testCaseId);
|
|
3211
|
-
continue;
|
|
3212
|
-
}
|
|
3213
|
-
if (!hasRun && rawState === 'active') {
|
|
3214
|
-
matrix.noRunHistoryActive += 1;
|
|
3215
|
-
pushSample('noRunHistoryActive', testCaseId);
|
|
3216
|
-
continue;
|
|
3217
|
-
}
|
|
3218
|
-
matrix.other += 1;
|
|
3219
|
-
pushSample('other', testCaseId);
|
|
3220
|
-
}
|
|
3221
|
-
logger_1.default.info(`MEWP run debug matrix (${contextLabel}): total=${matrix.total}; ` +
|
|
3222
|
-
`passOrFailWithActionResults=${matrix.passOrFailWithActionResults}; ` +
|
|
3223
|
-
`runWithNoActionResults=${matrix.runWithNoActionResults}; ` +
|
|
3224
|
-
`notApplicable=${matrix.notApplicable}; ` +
|
|
3225
|
-
`noRunHistoryActive=${matrix.noRunHistoryActive}; other=${matrix.other}; ` +
|
|
3226
|
-
`samplePassFail=${samples.passOrFailWithActionResults.join(',') || '-'}; ` +
|
|
3227
|
-
`sampleNoAction=${samples.runWithNoActionResults.join(',') || '-'}; ` +
|
|
3228
|
-
`sampleNA=${samples.notApplicable.join(',') || '-'}; ` +
|
|
3229
|
-
`sampleNoRunActive=${samples.noRunHistoryActive.join(',') || '-'}; ` +
|
|
3230
|
-
`sampleOther=${samples.other.join(',') || '-'}`);
|
|
3231
|
-
}
|
|
3232
3160
|
/**
|
|
3233
3161
|
* Converts a run status string into a human-readable format.
|
|
3234
3162
|
*
|
|
@@ -3532,10 +3460,6 @@ class ResultDataProvider {
|
|
|
3532
3460
|
}
|
|
3533
3461
|
resultData.iterationDetails.push(iteration);
|
|
3534
3462
|
}
|
|
3535
|
-
const originalActionResultsCount = Array.isArray(iteration === null || iteration === void 0 ? void 0 : iteration.actionResults)
|
|
3536
|
-
? iteration.actionResults.length
|
|
3537
|
-
: 0;
|
|
3538
|
-
resultData._debugOriginalActionResultsCount = originalActionResultsCount;
|
|
3539
3463
|
if (resultData.stepsResultXml && iteration) {
|
|
3540
3464
|
const actionResults = Array.isArray(iteration.actionResults) ? iteration.actionResults : [];
|
|
3541
3465
|
const actionResultsWithSharedModels = actionResults.filter((result) => result.sharedStepModel);
|
|
@@ -4077,13 +4001,13 @@ class ResultDataProvider {
|
|
|
4077
4001
|
*/
|
|
4078
4002
|
async fetchResultDataForTestReporter(projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory = false) {
|
|
4079
4003
|
return this.fetchResultDataBase(projectName, testSuiteId, point, (project, runId, resultId, fields, isQueryMode, point, includeAllHistory) => this.fetchResultDataBasedOnWiTestReporter(project, runId, resultId, fields, isQueryMode, point, includeAllHistory), (resultData, testSuiteId, point, selectedFields) => {
|
|
4080
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
4004
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
4081
4005
|
const { lastRunId, lastResultId, configurationName, lastResultDetails } = point;
|
|
4082
4006
|
try {
|
|
4083
4007
|
const iteration = ((_a = resultData.iterationDetails) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
4084
4008
|
? resultData.iterationDetails[((_b = resultData.iterationDetails) === null || _b === void 0 ? void 0 : _b.length) - 1]
|
|
4085
4009
|
: undefined;
|
|
4086
|
-
const
|
|
4010
|
+
const testOutcome = this.getTestOutcome(resultData);
|
|
4087
4011
|
if (!(resultData === null || resultData === void 0 ? void 0 : resultData.testCase) || !(resultData === null || resultData === void 0 ? void 0 : resultData.testSuite)) {
|
|
4088
4012
|
logger_1.default.debug(`[RunResult] Missing testCase/testSuite for point testCaseId=${String((_c = point === null || point === void 0 ? void 0 : point.testCaseId) !== null && _c !== void 0 ? _c : 'unknown')} (lastRunId=${String(lastRunId !== null && lastRunId !== void 0 ? lastRunId : '')}, lastResultId=${String(lastResultId !== null && lastResultId !== void 0 ? lastResultId : '')}). hasTestCase=${Boolean(resultData === null || resultData === void 0 ? void 0 : resultData.testCase)} hasTestSuite=${Boolean(resultData === null || resultData === void 0 ? void 0 : resultData.testSuite)}`);
|
|
4089
4013
|
}
|
|
@@ -4108,16 +4032,13 @@ class ResultDataProvider {
|
|
|
4108
4032
|
relatedCRs: resultData.relatedCRs || undefined,
|
|
4109
4033
|
lastRunResult: undefined,
|
|
4110
4034
|
customFields: {}, // Create an object to store custom fields
|
|
4111
|
-
_debugTestOutcome: debugOutcome,
|
|
4112
|
-
_debugTestCaseState: String((resultData === null || resultData === void 0 ? void 0 : resultData.state) || ''),
|
|
4113
|
-
_debugOriginalActionResultsCount: Number((_l = resultData === null || resultData === void 0 ? void 0 : resultData._debugOriginalActionResultsCount) !== null && _l !== void 0 ? _l : -1),
|
|
4114
4035
|
};
|
|
4115
4036
|
// Process all custom fields from resultData.filteredFields
|
|
4116
4037
|
if (resultData.filteredFields) {
|
|
4117
4038
|
const customFields = this.standardCustomField(resultData.filteredFields);
|
|
4118
4039
|
resultDataResponse.customFields = customFields;
|
|
4119
4040
|
}
|
|
4120
|
-
const filteredFields = (
|
|
4041
|
+
const filteredFields = (_l = selectedFields === null || selectedFields === void 0 ? void 0 : selectedFields.filter((field) => field.includes('@runResultField'))) === null || _l === void 0 ? void 0 : _l.map((field) => field.split('@')[0]);
|
|
4121
4042
|
if (filteredFields && filteredFields.length > 0) {
|
|
4122
4043
|
for (const field of filteredFields) {
|
|
4123
4044
|
switch (field) {
|
|
@@ -4127,13 +4048,13 @@ class ResultDataProvider {
|
|
|
4127
4048
|
case 'testCaseResult':
|
|
4128
4049
|
if (lastRunId === undefined || lastResultId === undefined) {
|
|
4129
4050
|
resultDataResponse.testCaseResult = {
|
|
4130
|
-
resultMessage: `${this.convertRunStatus(
|
|
4051
|
+
resultMessage: `${this.convertRunStatus(testOutcome)}`,
|
|
4131
4052
|
url: '',
|
|
4132
4053
|
};
|
|
4133
4054
|
}
|
|
4134
4055
|
else {
|
|
4135
4056
|
resultDataResponse.testCaseResult = {
|
|
4136
|
-
resultMessage: `${this.convertRunStatus(
|
|
4057
|
+
resultMessage: `${this.convertRunStatus(testOutcome)} in Run ${lastRunId}`,
|
|
4137
4058
|
url: `${this.orgUrl}${projectName}/_testManagement/runs?runId=${lastRunId}&_a=resultSummary&resultId=${lastResultId}`,
|
|
4138
4059
|
};
|
|
4139
4060
|
}
|
|
@@ -4145,16 +4066,16 @@ class ResultDataProvider {
|
|
|
4145
4066
|
resultDataResponse.failureType = resultData.failureType;
|
|
4146
4067
|
break;
|
|
4147
4068
|
case 'runBy':
|
|
4148
|
-
if (!((
|
|
4149
|
-
logger_1.default.debug(`[RunResult] Missing runBy for testCaseId=${String((
|
|
4069
|
+
if (!((_m = lastResultDetails === null || lastResultDetails === void 0 ? void 0 : lastResultDetails.runBy) === null || _m === void 0 ? void 0 : _m.displayName)) {
|
|
4070
|
+
logger_1.default.debug(`[RunResult] Missing runBy for testCaseId=${String((_q = (_p = (_o = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _o === void 0 ? void 0 : _o.id) !== null && _p !== void 0 ? _p : point === null || point === void 0 ? void 0 : point.testCaseId) !== null && _q !== void 0 ? _q : 'unknown')} (lastRunId=${String(lastRunId !== null && lastRunId !== void 0 ? lastRunId : '')}, lastResultId=${String(lastResultId !== null && lastResultId !== void 0 ? lastResultId : '')}). lastResultDetails=${this.stringifyForDebug(lastResultDetails, 2000)}`);
|
|
4150
4071
|
}
|
|
4151
|
-
resultDataResponse.runBy = (
|
|
4072
|
+
resultDataResponse.runBy = (_s = (_r = lastResultDetails === null || lastResultDetails === void 0 ? void 0 : lastResultDetails.runBy) === null || _r === void 0 ? void 0 : _r.displayName) !== null && _s !== void 0 ? _s : '';
|
|
4152
4073
|
break;
|
|
4153
4074
|
case 'executionDate':
|
|
4154
4075
|
if (!(lastResultDetails === null || lastResultDetails === void 0 ? void 0 : lastResultDetails.dateCompleted)) {
|
|
4155
|
-
logger_1.default.debug(`[RunResult] Missing dateCompleted for testCaseId=${String((
|
|
4076
|
+
logger_1.default.debug(`[RunResult] Missing dateCompleted for testCaseId=${String((_v = (_u = (_t = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _t === void 0 ? void 0 : _t.id) !== null && _u !== void 0 ? _u : point === null || point === void 0 ? void 0 : point.testCaseId) !== null && _v !== void 0 ? _v : 'unknown')} (lastRunId=${String(lastRunId !== null && lastRunId !== void 0 ? lastRunId : '')}, lastResultId=${String(lastResultId !== null && lastResultId !== void 0 ? lastResultId : '')}). lastResultDetails=${this.stringifyForDebug(lastResultDetails, 2000)}`);
|
|
4156
4077
|
}
|
|
4157
|
-
resultDataResponse.executionDate = (
|
|
4078
|
+
resultDataResponse.executionDate = (_w = lastResultDetails === null || lastResultDetails === void 0 ? void 0 : lastResultDetails.dateCompleted) !== null && _w !== void 0 ? _w : '';
|
|
4158
4079
|
break;
|
|
4159
4080
|
case 'configurationName':
|
|
4160
4081
|
resultDataResponse.configurationName = configurationName;
|