@elisra-devops/docgen-data-provider 1.73.0 → 1.74.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.d.ts +11 -1
- package/bin/modules/ResultDataProvider.js +278 -37
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +113 -9
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +390 -38
- package/src/tests/modules/ResultDataProvider.test.ts +140 -9
|
@@ -1075,7 +1075,102 @@ describe('ResultDataProvider', () => {
|
|
|
1075
1075
|
});
|
|
1076
1076
|
|
|
1077
1077
|
describe('getMewpL2CoverageFlatResults', () => {
|
|
1078
|
-
it('should
|
|
1078
|
+
it('should support query-mode requirement scope for MEWP coverage', async () => {
|
|
1079
|
+
jest.spyOn(resultDataProvider as any, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
1080
|
+
jest.spyOn(resultDataProvider as any, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
1081
|
+
jest.spyOn(resultDataProvider as any, 'fetchTestData').mockResolvedValueOnce([
|
|
1082
|
+
{
|
|
1083
|
+
testPointsItems: [{ testCaseId: 101, lastRunId: 10, lastResultId: 20, testCaseName: 'TC 101' }],
|
|
1084
|
+
testCasesItems: [
|
|
1085
|
+
{
|
|
1086
|
+
workItem: {
|
|
1087
|
+
id: 101,
|
|
1088
|
+
workItemFields: [{ key: 'System.Title', value: 'TC 101' }],
|
|
1089
|
+
},
|
|
1090
|
+
},
|
|
1091
|
+
],
|
|
1092
|
+
},
|
|
1093
|
+
]);
|
|
1094
|
+
jest.spyOn(resultDataProvider as any, 'fetchMewpRequirementTypeNames').mockResolvedValueOnce([
|
|
1095
|
+
'Requirement',
|
|
1096
|
+
]);
|
|
1097
|
+
jest.spyOn(resultDataProvider as any, 'fetchWorkItemsByIds').mockResolvedValueOnce([
|
|
1098
|
+
{
|
|
1099
|
+
id: 9001,
|
|
1100
|
+
fields: {
|
|
1101
|
+
'System.WorkItemType': 'Requirement',
|
|
1102
|
+
'System.Title': 'Requirement from query',
|
|
1103
|
+
'Custom.CustomerId': 'SR3001',
|
|
1104
|
+
'System.AreaPath': 'MEWP\\IL',
|
|
1105
|
+
},
|
|
1106
|
+
relations: [
|
|
1107
|
+
{
|
|
1108
|
+
rel: 'Microsoft.VSTS.Common.TestedBy-Forward',
|
|
1109
|
+
url: 'https://dev.azure.com/org/_apis/wit/workItems/101',
|
|
1110
|
+
},
|
|
1111
|
+
],
|
|
1112
|
+
},
|
|
1113
|
+
]);
|
|
1114
|
+
jest.spyOn(resultDataProvider as any, 'fetchAllResultDataTestReporter').mockResolvedValueOnce([
|
|
1115
|
+
{
|
|
1116
|
+
testCaseId: 101,
|
|
1117
|
+
testCase: { id: 101, name: 'TC 101' },
|
|
1118
|
+
iteration: {
|
|
1119
|
+
actionResults: [{ action: 'Validate SR3001', expected: '', outcome: 'Passed' }],
|
|
1120
|
+
},
|
|
1121
|
+
},
|
|
1122
|
+
]);
|
|
1123
|
+
|
|
1124
|
+
const TicketsProviderMock: any = require('../../modules/TicketsDataProvider').default;
|
|
1125
|
+
TicketsProviderMock.mockImplementationOnce(() => ({
|
|
1126
|
+
GetQueryResultsFromWiql: jest.fn().mockResolvedValue({
|
|
1127
|
+
fetchedWorkItems: [
|
|
1128
|
+
{
|
|
1129
|
+
id: 9001,
|
|
1130
|
+
fields: {
|
|
1131
|
+
'System.WorkItemType': 'Requirement',
|
|
1132
|
+
'System.Title': 'Requirement from query',
|
|
1133
|
+
'Custom.CustomerId': 'SR3001',
|
|
1134
|
+
'System.AreaPath': 'MEWP\\IL',
|
|
1135
|
+
},
|
|
1136
|
+
},
|
|
1137
|
+
],
|
|
1138
|
+
}),
|
|
1139
|
+
}));
|
|
1140
|
+
|
|
1141
|
+
const result = await (resultDataProvider as any).getMewpL2CoverageFlatResults(
|
|
1142
|
+
'123',
|
|
1143
|
+
mockProjectName,
|
|
1144
|
+
[1],
|
|
1145
|
+
{
|
|
1146
|
+
linkedQueryMode: 'query',
|
|
1147
|
+
testAssociatedQuery: { wiql: { href: 'https://example.com/wiql' } },
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
|
|
1151
|
+
const row = result.rows.find((item: any) => item['Customer ID'] === 'SR3001');
|
|
1152
|
+
expect(row).toEqual(
|
|
1153
|
+
expect.objectContaining({
|
|
1154
|
+
'Title (Customer name)': 'Requirement from query',
|
|
1155
|
+
'Responsibility - SAPWBS (ESUK/IL)': 'IL',
|
|
1156
|
+
'Test case id': 101,
|
|
1157
|
+
'Test case title': 'TC 101',
|
|
1158
|
+
'Number of passed steps': 1,
|
|
1159
|
+
'Number of failed steps': 0,
|
|
1160
|
+
'Number of not run tests': 0,
|
|
1161
|
+
})
|
|
1162
|
+
);
|
|
1163
|
+
|
|
1164
|
+
expect(TicketsProviderMock).toHaveBeenCalled();
|
|
1165
|
+
const instance = TicketsProviderMock.mock.results[0].value;
|
|
1166
|
+
expect(instance.GetQueryResultsFromWiql).toHaveBeenCalledWith(
|
|
1167
|
+
'https://example.com/wiql',
|
|
1168
|
+
true,
|
|
1169
|
+
expect.any(Map)
|
|
1170
|
+
);
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1173
|
+
it('should map SR ids from steps and output requirement-test-case coverage rows', async () => {
|
|
1079
1174
|
jest.spyOn(resultDataProvider as any, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
1080
1175
|
jest.spyOn(resultDataProvider as any, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
1081
1176
|
jest.spyOn(resultDataProvider as any, 'fetchTestData').mockResolvedValueOnce([
|
|
@@ -1105,7 +1200,14 @@ describe('ResultDataProvider', () => {
|
|
|
1105
1200
|
{
|
|
1106
1201
|
workItemId: 5002,
|
|
1107
1202
|
requirementId: 'SR1002',
|
|
1108
|
-
title: '
|
|
1203
|
+
title: 'Referenced from non-linked step text',
|
|
1204
|
+
responsibility: 'IL',
|
|
1205
|
+
linkedTestCaseIds: [],
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
workItemId: 5003,
|
|
1209
|
+
requirementId: 'SR1003',
|
|
1210
|
+
title: 'Not covered by any test case',
|
|
1109
1211
|
responsibility: 'IL',
|
|
1110
1212
|
linkedTestCaseIds: [],
|
|
1111
1213
|
},
|
|
@@ -1113,6 +1215,7 @@ describe('ResultDataProvider', () => {
|
|
|
1113
1215
|
jest.spyOn(resultDataProvider as any, 'fetchAllResultDataTestReporter').mockResolvedValueOnce([
|
|
1114
1216
|
{
|
|
1115
1217
|
testCaseId: 101,
|
|
1218
|
+
testCase: { id: 101, name: 'TC 101' },
|
|
1116
1219
|
iteration: {
|
|
1117
1220
|
actionResults: [
|
|
1118
1221
|
{
|
|
@@ -1127,6 +1230,7 @@ describe('ResultDataProvider', () => {
|
|
|
1127
1230
|
},
|
|
1128
1231
|
{
|
|
1129
1232
|
testCaseId: 102,
|
|
1233
|
+
testCase: { id: 102, name: 'TC 102' },
|
|
1130
1234
|
iteration: undefined,
|
|
1131
1235
|
},
|
|
1132
1236
|
]);
|
|
@@ -1151,25 +1255,50 @@ describe('ResultDataProvider', () => {
|
|
|
1151
1255
|
expect(result).toEqual(
|
|
1152
1256
|
expect.objectContaining({
|
|
1153
1257
|
sheetName: expect.stringContaining('MEWP L2 Coverage'),
|
|
1154
|
-
columnOrder: expect.arrayContaining(['
|
|
1258
|
+
columnOrder: expect.arrayContaining(['Customer ID', 'Test case id', 'Number of not run tests']),
|
|
1155
1259
|
})
|
|
1156
1260
|
);
|
|
1157
1261
|
|
|
1158
|
-
const covered = result.rows.find(
|
|
1159
|
-
|
|
1262
|
+
const covered = result.rows.find(
|
|
1263
|
+
(row: any) => row['Customer ID'] === 'SR1001' && row['Test case id'] === 101
|
|
1264
|
+
);
|
|
1265
|
+
const inferredByStepText = result.rows.find(
|
|
1266
|
+
(row: any) => row['Customer ID'] === 'SR1002' && row['Test case id'] === 102
|
|
1267
|
+
);
|
|
1268
|
+
const uncovered = result.rows.find(
|
|
1269
|
+
(row: any) =>
|
|
1270
|
+
row['Customer ID'] === 'SR1003' &&
|
|
1271
|
+
(row['Test case id'] === '' || row['Test case id'] === undefined || row['Test case id'] === null)
|
|
1272
|
+
);
|
|
1160
1273
|
|
|
1161
1274
|
expect(covered).toEqual(
|
|
1162
1275
|
expect.objectContaining({
|
|
1276
|
+
'Title (Customer name)': 'Covered requirement',
|
|
1277
|
+
'Responsibility - SAPWBS (ESUK/IL)': 'ESUK',
|
|
1278
|
+
'Test case title': 'TC 101',
|
|
1163
1279
|
'Number of passed steps': 1,
|
|
1164
1280
|
'Number of failed steps': 1,
|
|
1165
|
-
'Number of
|
|
1281
|
+
'Number of not run tests': 1,
|
|
1282
|
+
})
|
|
1283
|
+
);
|
|
1284
|
+
expect(inferredByStepText).toEqual(
|
|
1285
|
+
expect.objectContaining({
|
|
1286
|
+
'Title (Customer name)': 'Referenced from non-linked step text',
|
|
1287
|
+
'Responsibility - SAPWBS (ESUK/IL)': 'IL',
|
|
1288
|
+
'Test case title': 'TC 102',
|
|
1289
|
+
'Number of passed steps': 0,
|
|
1290
|
+
'Number of failed steps': 0,
|
|
1291
|
+
'Number of not run tests': 1,
|
|
1166
1292
|
})
|
|
1167
1293
|
);
|
|
1168
1294
|
expect(uncovered).toEqual(
|
|
1169
1295
|
expect.objectContaining({
|
|
1296
|
+
'Title (Customer name)': 'Not covered by any test case',
|
|
1297
|
+
'Responsibility - SAPWBS (ESUK/IL)': 'IL',
|
|
1298
|
+
'Test case title': '',
|
|
1170
1299
|
'Number of passed steps': 0,
|
|
1171
1300
|
'Number of failed steps': 0,
|
|
1172
|
-
'Number of
|
|
1301
|
+
'Number of not run tests': 0,
|
|
1173
1302
|
})
|
|
1174
1303
|
);
|
|
1175
1304
|
});
|
|
@@ -1235,13 +1364,15 @@ describe('ResultDataProvider', () => {
|
|
|
1235
1364
|
[1]
|
|
1236
1365
|
);
|
|
1237
1366
|
|
|
1238
|
-
const row = result.rows.find(
|
|
1367
|
+
const row = result.rows.find(
|
|
1368
|
+
(item: any) => item['Customer ID'] === 'SR2001' && item['Test case id'] === 101
|
|
1369
|
+
);
|
|
1239
1370
|
expect(parseSpy).not.toHaveBeenCalled();
|
|
1240
1371
|
expect(row).toEqual(
|
|
1241
1372
|
expect.objectContaining({
|
|
1242
1373
|
'Number of passed steps': 0,
|
|
1243
1374
|
'Number of failed steps': 0,
|
|
1244
|
-
'Number of
|
|
1375
|
+
'Number of not run tests': 0,
|
|
1245
1376
|
})
|
|
1246
1377
|
);
|
|
1247
1378
|
});
|