@elisra-devops/docgen-data-provider 1.76.0 → 1.77.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/modules/ResultDataProvider.js +42 -2
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/utils/mewpExternalIngestionUtils.js +85 -13
- package/bin/utils/mewpExternalIngestionUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +57 -0
- package/src/utils/mewpExternalIngestionUtils.ts +96 -17
|
@@ -288,7 +288,7 @@ class ResultDataProvider {
|
|
|
288
288
|
* Rows are one Requirement-TestCase pair; uncovered requirements are emitted with empty test-case columns.
|
|
289
289
|
*/
|
|
290
290
|
async getMewpL2CoverageFlatResults(testPlanId, projectName, selectedSuiteIds, linkedQueryRequest, options) {
|
|
291
|
-
var _a;
|
|
291
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
292
292
|
const defaultPayload = {
|
|
293
293
|
sheetName: `MEWP L2 Coverage - Plan ${testPlanId}`,
|
|
294
294
|
columnOrder: [...ResultDataProvider.MEWP_L2_COVERAGE_COLUMNS],
|
|
@@ -307,6 +307,29 @@ class ResultDataProvider {
|
|
|
307
307
|
const requirementSapWbsByBaseKey = this.buildRequirementSapWbsByBaseKey(allRequirements);
|
|
308
308
|
const externalBugsByTestCase = await this.loadExternalBugsByTestCase(options === null || options === void 0 ? void 0 : options.externalBugsFile);
|
|
309
309
|
const externalL3L4ByBaseKey = await this.loadExternalL3L4ByBaseKey(options === null || options === void 0 ? void 0 : options.externalL3L4File, requirementSapWbsByBaseKey);
|
|
310
|
+
const hasExternalBugsFile = !!String(((_a = options === null || options === void 0 ? void 0 : options.externalBugsFile) === null || _a === void 0 ? void 0 : _a.name) ||
|
|
311
|
+
((_b = options === null || options === void 0 ? void 0 : options.externalBugsFile) === null || _b === void 0 ? void 0 : _b.objectName) ||
|
|
312
|
+
((_c = options === null || options === void 0 ? void 0 : options.externalBugsFile) === null || _c === void 0 ? void 0 : _c.text) ||
|
|
313
|
+
((_d = options === null || options === void 0 ? void 0 : options.externalBugsFile) === null || _d === void 0 ? void 0 : _d.url) ||
|
|
314
|
+
'').trim();
|
|
315
|
+
const hasExternalL3L4File = !!String(((_e = options === null || options === void 0 ? void 0 : options.externalL3L4File) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
316
|
+
((_f = options === null || options === void 0 ? void 0 : options.externalL3L4File) === null || _f === void 0 ? void 0 : _f.objectName) ||
|
|
317
|
+
((_g = options === null || options === void 0 ? void 0 : options.externalL3L4File) === null || _g === void 0 ? void 0 : _g.text) ||
|
|
318
|
+
((_h = options === null || options === void 0 ? void 0 : options.externalL3L4File) === null || _h === void 0 ? void 0 : _h.url) ||
|
|
319
|
+
'').trim();
|
|
320
|
+
const externalBugLinksCount = [...externalBugsByTestCase.values()].reduce((sum, items) => sum + (Array.isArray(items) ? items.length : 0), 0);
|
|
321
|
+
const externalL3L4LinksCount = [...externalL3L4ByBaseKey.values()].reduce((sum, items) => sum + (Array.isArray(items) ? items.length : 0), 0);
|
|
322
|
+
logger_1.default.info(`MEWP coverage external ingestion summary: ` +
|
|
323
|
+
`bugsFileProvided=${hasExternalBugsFile} bugsTestCases=${externalBugsByTestCase.size} bugsLinks=${externalBugLinksCount}; ` +
|
|
324
|
+
`l3l4FileProvided=${hasExternalL3L4File} l3l4BaseKeys=${externalL3L4ByBaseKey.size} l3l4Links=${externalL3L4LinksCount}`);
|
|
325
|
+
if (hasExternalBugsFile && externalBugLinksCount === 0) {
|
|
326
|
+
logger_1.default.warn(`MEWP coverage: external bugs file was provided but produced 0 links. ` +
|
|
327
|
+
`Check SR/test-case/state values in ingestion logs.`);
|
|
328
|
+
}
|
|
329
|
+
if (hasExternalL3L4File && externalL3L4LinksCount === 0) {
|
|
330
|
+
logger_1.default.warn(`MEWP coverage: external L3/L4 file was provided but produced 0 links. ` +
|
|
331
|
+
`Check SR/AREA34/state/SAPWBS filters in ingestion logs.`);
|
|
332
|
+
}
|
|
310
333
|
if (requirements.length === 0) {
|
|
311
334
|
return Object.assign(Object.assign({}, defaultPayload), { sheetName: this.buildMewpCoverageSheetName(planName, testPlanId) });
|
|
312
335
|
}
|
|
@@ -324,7 +347,7 @@ class ResultDataProvider {
|
|
|
324
347
|
const runResults = await this.fetchAllResultDataTestReporter(testData, projectName, [], false, false);
|
|
325
348
|
for (const runResult of runResults) {
|
|
326
349
|
const testCaseId = this.extractMewpTestCaseId(runResult);
|
|
327
|
-
const rawActionResults = Array.isArray((
|
|
350
|
+
const rawActionResults = Array.isArray((_j = runResult === null || runResult === void 0 ? void 0 : runResult.iteration) === null || _j === void 0 ? void 0 : _j.actionResults)
|
|
328
351
|
? runResult.iteration.actionResults.filter((item) => !(item === null || item === void 0 ? void 0 : item.isSharedStepTitle))
|
|
329
352
|
: [];
|
|
330
353
|
const actionResults = rawActionResults.sort((a, b) => this.compareActionResults(String((a === null || a === void 0 ? void 0 : a.stepPosition) || (a === null || a === void 0 ? void 0 : a.stepIdentifier) || ''), String((b === null || b === void 0 ? void 0 : b.stepPosition) || (b === null || b === void 0 ? void 0 : b.stepIdentifier) || '')));
|
|
@@ -359,6 +382,23 @@ class ResultDataProvider {
|
|
|
359
382
|
this.accumulateRequirementCountsFromActionResults(fallbackActionResults, testCaseId, requirementKeys, requirementIndex, observedTestCaseIdsByRequirement);
|
|
360
383
|
}
|
|
361
384
|
const rows = this.buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, externalL3L4ByBaseKey, externalBugsByTestCase);
|
|
385
|
+
const coverageRowStats = rows.reduce((acc, row) => {
|
|
386
|
+
const hasBug = Number((row === null || row === void 0 ? void 0 : row['Bug ID']) || 0) > 0;
|
|
387
|
+
const hasL3 = String((row === null || row === void 0 ? void 0 : row['L3 REQ ID']) || '').trim() !== '';
|
|
388
|
+
const hasL4 = String((row === null || row === void 0 ? void 0 : row['L4 REQ ID']) || '').trim() !== '';
|
|
389
|
+
if (hasBug)
|
|
390
|
+
acc.bugRows += 1;
|
|
391
|
+
if (hasL3)
|
|
392
|
+
acc.l3Rows += 1;
|
|
393
|
+
if (hasL4)
|
|
394
|
+
acc.l4Rows += 1;
|
|
395
|
+
if (!hasBug && !hasL3 && !hasL4)
|
|
396
|
+
acc.baseOnlyRows += 1;
|
|
397
|
+
return acc;
|
|
398
|
+
}, { bugRows: 0, l3Rows: 0, l4Rows: 0, baseOnlyRows: 0 });
|
|
399
|
+
logger_1.default.info(`MEWP coverage output summary: requirements=${requirements.length} rows=${rows.length} ` +
|
|
400
|
+
`bugRows=${coverageRowStats.bugRows} l3Rows=${coverageRowStats.l3Rows} ` +
|
|
401
|
+
`l4Rows=${coverageRowStats.l4Rows} baseOnlyRows=${coverageRowStats.baseOnlyRows}`);
|
|
362
402
|
return {
|
|
363
403
|
sheetName: this.buildMewpCoverageSheetName(planName, testPlanId),
|
|
364
404
|
columnOrder: [...ResultDataProvider.MEWP_L2_COVERAGE_COLUMNS],
|