@elisra-devops/docgen-data-provider 0.4.16 → 0.6.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/helpers/helper.js +22 -7
- package/bin/helpers/helper.js.map +1 -1
- package/bin/helpers/tfs.js +62 -77
- package/bin/helpers/tfs.js.map +1 -1
- package/bin/index.d.ts +3 -1
- package/bin/index.js +17 -31
- package/bin/index.js.map +1 -1
- package/bin/models/tfs-data.d.ts +11 -1
- package/bin/models/tfs-data.js +59 -14
- package/bin/models/tfs-data.js.map +1 -1
- package/bin/modules/GitDataProvider.js +213 -259
- package/bin/modules/GitDataProvider.js.map +1 -1
- package/bin/modules/MangementDataProvider.js +26 -43
- package/bin/modules/MangementDataProvider.js.map +1 -1
- package/bin/modules/PipelinesDataProvider.js +57 -82
- package/bin/modules/PipelinesDataProvider.js.map +1 -1
- package/bin/modules/ResultDataProvider.d.ts +89 -0
- package/bin/modules/ResultDataProvider.js +409 -0
- package/bin/modules/ResultDataProvider.js.map +1 -0
- package/bin/modules/TestDataProvider.d.ts +6 -4
- package/bin/modules/TestDataProvider.js +220 -250
- package/bin/modules/TestDataProvider.js.map +1 -1
- package/bin/modules/TicketsDataProvider.js +259 -300
- package/bin/modules/TicketsDataProvider.js.map +1 -1
- package/bin/modules/test/gitDataProvider.test.js +67 -76
- package/bin/modules/test/gitDataProvider.test.js.map +1 -1
- package/bin/modules/test/managmentDataProvider.test.js +16 -25
- package/bin/modules/test/managmentDataProvider.test.js.map +1 -1
- package/bin/modules/test/pipelineDataProvider.test.js +32 -41
- package/bin/modules/test/pipelineDataProvider.test.js.map +1 -1
- package/bin/modules/test/testDataProvider.test.js +67 -75
- package/bin/modules/test/testDataProvider.test.js.map +1 -1
- package/bin/modules/test/ticketsDataProvider.test.js +39 -48
- package/bin/modules/test/ticketsDataProvider.test.js.map +1 -1
- package/package.json +17 -11
- package/src/index.ts +19 -15
- package/src/models/tfs-data.ts +29 -8
- package/src/modules/ResultDataProvider.ts +496 -0
- package/src/modules/TestDataProvider.ts +150 -235
- package/src/modules/test/testDataProvider.test.ts +82 -104
- package/tsconfig.json +2 -2
|
@@ -1,93 +1,63 @@
|
|
|
1
|
-
import { TFSServices } from
|
|
2
|
-
import { Workitem } from
|
|
3
|
-
import { Helper, suiteData, Links, Trace, Relations } from
|
|
4
|
-
import { Query, TestSteps,
|
|
5
|
-
import { QueryType } from
|
|
6
|
-
import { QueryAllTypes } from
|
|
7
|
-
import { Column } from
|
|
8
|
-
import { value } from
|
|
9
|
-
import { TestCase } from
|
|
10
|
-
import * as xml2js from
|
|
1
|
+
import { TFSServices } from '../helpers/tfs';
|
|
2
|
+
import { Workitem } from '../models/tfs-data';
|
|
3
|
+
import { Helper, suiteData, Links, Trace, Relations } from '../helpers/helper';
|
|
4
|
+
import { Query, TestSteps, createBugRelation, createRequirementRelation } from '../models/tfs-data';
|
|
5
|
+
import { QueryType } from '../models/tfs-data';
|
|
6
|
+
import { QueryAllTypes } from '../models/tfs-data';
|
|
7
|
+
import { Column } from '../models/tfs-data';
|
|
8
|
+
import { value } from '../models/tfs-data';
|
|
9
|
+
import { TestCase } from '../models/tfs-data';
|
|
10
|
+
import * as xml2js from 'xml2js';
|
|
11
11
|
|
|
12
|
-
import logger from
|
|
12
|
+
import logger from '../utils/logger';
|
|
13
|
+
import { log } from 'winston';
|
|
13
14
|
|
|
14
15
|
export default class TestDataProvider {
|
|
15
|
-
orgUrl: string =
|
|
16
|
-
token: string =
|
|
17
|
-
|
|
16
|
+
orgUrl: string = '';
|
|
17
|
+
token: string = '';
|
|
18
|
+
|
|
18
19
|
constructor(orgUrl: string, token: string) {
|
|
19
20
|
this.orgUrl = orgUrl;
|
|
20
21
|
this.token = token;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
async GetTestSuiteByTestCase(
|
|
24
|
-
testCaseId: string
|
|
25
|
-
): Promise<any> {
|
|
24
|
+
async GetTestSuiteByTestCase(testCaseId: string): Promise<any> {
|
|
26
25
|
let url = `${this.orgUrl}/_apis/testplan/suites?testCaseId=${testCaseId}`;
|
|
27
26
|
let testCaseData = await TFSServices.getItemContent(url, this.token);
|
|
28
27
|
return testCaseData;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
//get all test plans in the project
|
|
32
|
-
async GetTestPlans(
|
|
33
|
-
project: string
|
|
34
|
-
): Promise<string> {
|
|
31
|
+
async GetTestPlans(project: string): Promise<string> {
|
|
35
32
|
let testPlanUrl: string = `${this.orgUrl}${project}/_apis/test/plans`;
|
|
36
|
-
return TFSServices.getItemContent(testPlanUrl,this.token);
|
|
33
|
+
return TFSServices.getItemContent(testPlanUrl, this.token);
|
|
37
34
|
}
|
|
35
|
+
//async get data test
|
|
38
36
|
|
|
39
37
|
// get all test suits in projct test plan
|
|
40
|
-
async GetTestSuites(
|
|
41
|
-
|
|
42
|
-
planId: string
|
|
43
|
-
): Promise<any> {
|
|
44
|
-
let testsuitesUrl: string =
|
|
45
|
-
this.orgUrl + project + "/_apis/test/Plans/" + planId + "/suites";
|
|
38
|
+
async GetTestSuites(project: string, planId: string): Promise<any> {
|
|
39
|
+
let testsuitesUrl: string = this.orgUrl + project + '/_apis/test/Plans/' + planId + '/suites';
|
|
46
40
|
try {
|
|
47
|
-
let testSuites = await TFSServices.getItemContent(
|
|
48
|
-
testsuitesUrl,
|
|
49
|
-
this.token
|
|
50
|
-
);
|
|
41
|
+
let testSuites = await TFSServices.getItemContent(testsuitesUrl, this.token);
|
|
51
42
|
return testSuites;
|
|
52
43
|
} catch (e) {}
|
|
53
44
|
}
|
|
54
45
|
|
|
55
|
-
async GetTestSuitesForPlan(
|
|
56
|
-
project: string,
|
|
57
|
-
planid: string
|
|
58
|
-
): Promise<any> {
|
|
46
|
+
async GetTestSuitesForPlan(project: string, planid: string): Promise<any> {
|
|
59
47
|
let url =
|
|
60
|
-
this.orgUrl +
|
|
61
|
-
"/" +
|
|
62
|
-
project +
|
|
63
|
-
"/_api/_testManagement/GetTestSuitesForPlan?__v=5&planId=" +
|
|
64
|
-
planid;
|
|
48
|
+
this.orgUrl + '/' + project + '/_api/_testManagement/GetTestSuitesForPlan?__v=5&planId=' + planid;
|
|
65
49
|
let suites = await TFSServices.getItemContent(url, this.token);
|
|
66
50
|
return suites;
|
|
67
51
|
}
|
|
68
52
|
|
|
69
|
-
async GetTestSuitesByPlan(
|
|
70
|
-
project: string,
|
|
71
|
-
planId: string,
|
|
72
|
-
recursive: boolean
|
|
73
|
-
): Promise<any> {
|
|
53
|
+
async GetTestSuitesByPlan(project: string, planId: string, recursive: boolean): Promise<any> {
|
|
74
54
|
let suiteId = Number(planId) + 1;
|
|
75
|
-
let suites = await this.GetTestSuiteById(
|
|
76
|
-
project,
|
|
77
|
-
planId,
|
|
78
|
-
suiteId.toString(),
|
|
79
|
-
recursive
|
|
80
|
-
);
|
|
55
|
+
let suites = await this.GetTestSuiteById(project, planId, suiteId.toString(), recursive);
|
|
81
56
|
return suites;
|
|
82
57
|
}
|
|
83
58
|
//gets all testsuits recorsivly under test suite
|
|
84
59
|
|
|
85
|
-
async GetTestSuiteById(
|
|
86
|
-
project: string,
|
|
87
|
-
planId: string,
|
|
88
|
-
suiteId: string,
|
|
89
|
-
recursive: boolean
|
|
90
|
-
): Promise<any> {
|
|
60
|
+
async GetTestSuiteById(project: string, planId: string, suiteId: string, recursive: boolean): Promise<any> {
|
|
91
61
|
let testSuites = await this.GetTestSuitesForPlan(project, planId);
|
|
92
62
|
// GetTestSuites(project, planId);
|
|
93
63
|
Helper.suitList = [];
|
|
@@ -111,8 +81,10 @@ export default class TestDataProvider {
|
|
|
111
81
|
planId: string,
|
|
112
82
|
suiteId: string,
|
|
113
83
|
recursiv: boolean,
|
|
114
|
-
|
|
115
|
-
CustomerRequirementId: boolean
|
|
84
|
+
includeRequirements: boolean,
|
|
85
|
+
CustomerRequirementId: boolean,
|
|
86
|
+
includeBugs: boolean,
|
|
87
|
+
includeSeverity: boolean
|
|
116
88
|
): Promise<Array<any>> {
|
|
117
89
|
let testCasesList: Array<any> = new Array<any>();
|
|
118
90
|
let suitesTestCasesList: Array<suiteData> = await this.GetTestSuiteById(
|
|
@@ -122,20 +94,17 @@ export default class TestDataProvider {
|
|
|
122
94
|
recursiv
|
|
123
95
|
);
|
|
124
96
|
for (let i = 0; i < suitesTestCasesList.length; i++) {
|
|
125
|
-
let testCases: any = await this.GetTestCases(
|
|
126
|
-
project,
|
|
127
|
-
planId,
|
|
128
|
-
suitesTestCasesList[i].id
|
|
129
|
-
);
|
|
97
|
+
let testCases: any = await this.GetTestCases(project, planId, suitesTestCasesList[i].id);
|
|
130
98
|
let testCseseWithSteps: any = await this.StructureTestCase(
|
|
131
99
|
project,
|
|
132
100
|
testCases,
|
|
133
101
|
suitesTestCasesList[i],
|
|
134
|
-
|
|
135
|
-
CustomerRequirementId
|
|
102
|
+
includeRequirements,
|
|
103
|
+
CustomerRequirementId,
|
|
104
|
+
includeBugs,
|
|
105
|
+
includeSeverity
|
|
136
106
|
);
|
|
137
|
-
if (testCseseWithSteps.length > 0)
|
|
138
|
-
testCasesList = [...testCasesList, ...testCseseWithSteps];
|
|
107
|
+
if (testCseseWithSteps.length > 0) testCasesList = [...testCasesList, ...testCseseWithSteps];
|
|
139
108
|
}
|
|
140
109
|
return testCasesList;
|
|
141
110
|
}
|
|
@@ -144,84 +113,109 @@ export default class TestDataProvider {
|
|
|
144
113
|
project: string,
|
|
145
114
|
testCases: any,
|
|
146
115
|
suite: suiteData,
|
|
147
|
-
|
|
148
|
-
CustomerRequirementId: boolean
|
|
116
|
+
includeRequirements: boolean,
|
|
117
|
+
CustomerRequirementId: boolean,
|
|
118
|
+
includeBugs: boolean,
|
|
119
|
+
includeSeverity: boolean
|
|
149
120
|
): Promise<Array<any>> {
|
|
150
|
-
|
|
151
|
-
let url = this.orgUrl + project + "/_workitems/edit/";
|
|
121
|
+
let url = this.orgUrl + project + '/_workitems/edit/';
|
|
152
122
|
let testCasesUrlList: Array<any> = new Array<any>();
|
|
153
123
|
//let tesrCase:TestCase;
|
|
154
124
|
for (let i = 0; i < testCases.count; i++) {
|
|
155
|
-
try{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.token
|
|
160
|
-
);
|
|
161
|
-
let testCase: TestCase = new TestCase();
|
|
125
|
+
try {
|
|
126
|
+
let newurl = testCases.value[i].testCase.url + '?$expand=All';
|
|
127
|
+
let test: any = await TFSServices.getItemContent(newurl, this.token);
|
|
128
|
+
let testCase: TestCase = new TestCase();
|
|
162
129
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (relations && test.relations) {
|
|
177
|
-
for (const relation of test.relations) {
|
|
130
|
+
testCase.title = test.fields['System.Title'];
|
|
131
|
+
testCase.area = test.fields['System.AreaPath'];
|
|
132
|
+
testCase.description = test.fields['System.Description'];
|
|
133
|
+
testCase.url = url + test.id;
|
|
134
|
+
//testCase.steps = test.fields["Microsoft.VSTS.TCM.Steps"];
|
|
135
|
+
testCase.id = test.id;
|
|
136
|
+
testCase.suit = suite.id;
|
|
137
|
+
if (test.fields['Microsoft.VSTS.TCM.Steps'] != null) {
|
|
138
|
+
let steps: Array<TestSteps> = this.ParseSteps(test.fields['Microsoft.VSTS.TCM.Steps']);
|
|
139
|
+
testCase.steps = steps;
|
|
140
|
+
}
|
|
141
|
+
if ((includeBugs || includeRequirements) && test.relations) {
|
|
142
|
+
for (const relation of test.relations) {
|
|
178
143
|
// Only proceed if the URL contains 'workItems'
|
|
179
144
|
if (relation.url.includes('/workItems/')) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
} catch (fetchError) {
|
|
200
|
-
// Log error silently or handle as needed
|
|
201
|
-
console.error("Failed to fetch relation content", fetchError);
|
|
202
|
-
logger.error(`Failed to fetch relation content for URL ${relation.url}: ${fetchError}`);
|
|
145
|
+
try {
|
|
146
|
+
let relatedItemContent: any = await TFSServices.getItemContent(relation.url, this.token);
|
|
147
|
+
// Check if the WorkItemType is "Requirement" before adding to relations
|
|
148
|
+
if (
|
|
149
|
+
includeRequirements &&
|
|
150
|
+
relatedItemContent.fields['System.WorkItemType'] === 'Requirement'
|
|
151
|
+
) {
|
|
152
|
+
const newRequirementRelation = this.createNewRequirement(
|
|
153
|
+
CustomerRequirementId,
|
|
154
|
+
relatedItemContent
|
|
155
|
+
);
|
|
156
|
+
testCase.relations.push(newRequirementRelation);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Check if the WorkItemType is "Requirement" before adding to relations
|
|
160
|
+
if (includeBugs && relatedItemContent.fields['System.WorkItemType'] === 'Bug') {
|
|
161
|
+
const newBugRelation = this.createBugRelation(includeSeverity, relatedItemContent);
|
|
162
|
+
testCase.relations.push(newBugRelation);
|
|
203
163
|
}
|
|
164
|
+
} catch (fetchError) {
|
|
165
|
+
// Log error silently or handle as needed
|
|
166
|
+
console.error('Failed to fetch relation content', fetchError);
|
|
167
|
+
logger.error(`Failed to fetch relation content for URL ${relation.url}: ${fetchError}`);
|
|
168
|
+
}
|
|
204
169
|
}
|
|
170
|
+
}
|
|
205
171
|
}
|
|
206
|
-
|
|
207
|
-
|
|
172
|
+
testCasesUrlList.push(testCase);
|
|
173
|
+
} catch {
|
|
174
|
+
logger.error(`ran into an issue while retriving testCase ${testCases.value[i].testCase.id}`);
|
|
175
|
+
}
|
|
208
176
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
177
|
+
|
|
178
|
+
return testCasesUrlList;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private createBugRelation(includeSeverity: boolean, relatedItemContent: any) {
|
|
182
|
+
let severity = undefined;
|
|
183
|
+
// Check if CustomerRequirementId is true and set customerId
|
|
184
|
+
if (includeSeverity) {
|
|
185
|
+
// Add severity here
|
|
186
|
+
severity = relatedItemContent.fields['Microsoft.VSTS.Common.Severity'];
|
|
212
187
|
}
|
|
213
|
-
|
|
188
|
+
const newBugRelation = createBugRelation(
|
|
189
|
+
relatedItemContent.id,
|
|
190
|
+
relatedItemContent.fields['System.Title'],
|
|
191
|
+
severity
|
|
192
|
+
);
|
|
193
|
+
return newBugRelation;
|
|
214
194
|
}
|
|
215
195
|
|
|
216
|
-
|
|
196
|
+
private createNewRequirement(CustomerRequirementId: boolean, relatedItemContent: any) {
|
|
197
|
+
let customerId = undefined;
|
|
198
|
+
// Check if CustomerRequirementId is true and set customerId
|
|
199
|
+
if (CustomerRequirementId) {
|
|
200
|
+
// Here we check for either of the two potential fields for customer ID
|
|
201
|
+
customerId =
|
|
202
|
+
relatedItemContent.fields['Custom.CustomerRequirementID'] ||
|
|
203
|
+
relatedItemContent.fields['Custom.CustomerID'] ||
|
|
204
|
+
relatedItemContent.fields['Elisra.CustomerRequirementId'] ||
|
|
205
|
+
' ';
|
|
206
|
+
}
|
|
207
|
+
const newRequirementRelation = createRequirementRelation(
|
|
208
|
+
relatedItemContent.id,
|
|
209
|
+
relatedItemContent.fields['System.Title'],
|
|
210
|
+
customerId
|
|
211
|
+
);
|
|
212
|
+
return newRequirementRelation;
|
|
217
213
|
}
|
|
218
214
|
|
|
219
|
-
ParseSteps(
|
|
220
|
-
steps: string
|
|
221
|
-
) {
|
|
215
|
+
ParseSteps(steps: string) {
|
|
222
216
|
let stepsLsist: Array<TestSteps> = new Array<TestSteps>();
|
|
223
|
-
const start: string =
|
|
224
|
-
const end: string =
|
|
217
|
+
const start: string = ';P>';
|
|
218
|
+
const end: string = '</P';
|
|
225
219
|
let totalString: String = steps;
|
|
226
220
|
xml2js.parseString(steps, function (err, result) {
|
|
227
221
|
if (err) console.log(err);
|
|
@@ -230,17 +224,13 @@ export default class TestDataProvider {
|
|
|
230
224
|
let step: TestSteps = new TestSteps();
|
|
231
225
|
try {
|
|
232
226
|
if (result.steps.step[i].parameterizedString[0]._ != null)
|
|
233
|
-
step.action = result.steps.step[
|
|
234
|
-
i
|
|
235
|
-
].parameterizedString[0]._
|
|
227
|
+
step.action = result.steps.step[i].parameterizedString[0]._;
|
|
236
228
|
} catch (e) {
|
|
237
229
|
logger.warn(`No test step action data to parse for testcase `);
|
|
238
230
|
}
|
|
239
231
|
try {
|
|
240
232
|
if (result.steps.step[i].parameterizedString[1]._ != null)
|
|
241
|
-
step.expected = result.steps.step[
|
|
242
|
-
i
|
|
243
|
-
].parameterizedString[1]._
|
|
233
|
+
step.expected = result.steps.step[i].parameterizedString[1]._;
|
|
244
234
|
} catch (e) {
|
|
245
235
|
logger.warn(`No test step expected data to parse for testcase `);
|
|
246
236
|
}
|
|
@@ -251,39 +241,17 @@ export default class TestDataProvider {
|
|
|
251
241
|
return stepsLsist;
|
|
252
242
|
}
|
|
253
243
|
|
|
254
|
-
async GetTestCases(
|
|
255
|
-
project: string,
|
|
256
|
-
planId: string,
|
|
257
|
-
suiteId: string
|
|
258
|
-
): Promise<any> {
|
|
244
|
+
async GetTestCases(project: string, planId: string, suiteId: string): Promise<any> {
|
|
259
245
|
let testCaseUrl: string =
|
|
260
|
-
this.orgUrl +
|
|
261
|
-
|
|
262
|
-
"/_apis/test/Plans/" +
|
|
263
|
-
planId +
|
|
264
|
-
"/suites/" +
|
|
265
|
-
suiteId +
|
|
266
|
-
"/testcases/";
|
|
267
|
-
let testCases: any = await TFSServices.getItemContent(
|
|
268
|
-
testCaseUrl,
|
|
269
|
-
this.token
|
|
270
|
-
);
|
|
246
|
+
this.orgUrl + project + '/_apis/test/Plans/' + planId + '/suites/' + suiteId + '/testcases/';
|
|
247
|
+
let testCases: any = await TFSServices.getItemContent(testCaseUrl, this.token);
|
|
271
248
|
return testCases;
|
|
272
249
|
}
|
|
273
250
|
|
|
274
251
|
//gets all test point in a test case
|
|
275
|
-
async GetTestPoint(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
suiteId: string,
|
|
279
|
-
testCaseId: string
|
|
280
|
-
): Promise<any> {
|
|
281
|
-
let testPointUrl: string =
|
|
282
|
-
`${this.orgUrl}${project}/_apis/test/Plans/${planId}/Suites/${suiteId}/points?testCaseId=${testCaseId}`;
|
|
283
|
-
let testPoints: any = await TFSServices.getItemContent(
|
|
284
|
-
testPointUrl,
|
|
285
|
-
this.token
|
|
286
|
-
);
|
|
252
|
+
async GetTestPoint(project: string, planId: string, suiteId: string, testCaseId: string): Promise<any> {
|
|
253
|
+
let testPointUrl: string = `${this.orgUrl}${project}/_apis/test/Plans/${planId}/Suites/${suiteId}/points?testCaseId=${testCaseId}`;
|
|
254
|
+
let testPoints: any = await TFSServices.getItemContent(testPointUrl, this.token);
|
|
287
255
|
return testPoints;
|
|
288
256
|
}
|
|
289
257
|
|
|
@@ -294,9 +262,7 @@ export default class TestDataProvider {
|
|
|
294
262
|
testPointId: string
|
|
295
263
|
): Promise<any> {
|
|
296
264
|
try {
|
|
297
|
-
logger.info(
|
|
298
|
-
`Create test run op test point ${testPointId} ,test planId : ${testPlanId}`
|
|
299
|
-
);
|
|
265
|
+
logger.info(`Create test run op test point ${testPointId} ,test planId : ${testPlanId}`);
|
|
300
266
|
let Url = `${this.orgUrl}${projectName}/_apis/test/runs`;
|
|
301
267
|
let data = {
|
|
302
268
|
name: testRunName,
|
|
@@ -305,13 +271,7 @@ export default class TestDataProvider {
|
|
|
305
271
|
},
|
|
306
272
|
pointIds: [testPointId],
|
|
307
273
|
};
|
|
308
|
-
let res = await TFSServices.postRequest(
|
|
309
|
-
Url,
|
|
310
|
-
this.token,
|
|
311
|
-
"Post",
|
|
312
|
-
data,
|
|
313
|
-
null
|
|
314
|
-
);
|
|
274
|
+
let res = await TFSServices.postRequest(Url, this.token, 'Post', data, null);
|
|
315
275
|
return res;
|
|
316
276
|
} catch (err) {
|
|
317
277
|
logger.error(`Error : ${err}`);
|
|
@@ -319,31 +279,17 @@ export default class TestDataProvider {
|
|
|
319
279
|
}
|
|
320
280
|
}
|
|
321
281
|
|
|
322
|
-
async UpdateTestRun(
|
|
323
|
-
projectName: string,
|
|
324
|
-
runId: string,
|
|
325
|
-
state: string
|
|
326
|
-
): Promise<any> {
|
|
282
|
+
async UpdateTestRun(projectName: string, runId: string, state: string): Promise<any> {
|
|
327
283
|
logger.info(`Update runId : ${runId} to state : ${state}`);
|
|
328
284
|
let Url = `${this.orgUrl}${projectName}/_apis/test/Runs/${runId}?api-version=5.0`;
|
|
329
285
|
let data = {
|
|
330
286
|
state: state,
|
|
331
287
|
};
|
|
332
|
-
let res = await TFSServices.postRequest(
|
|
333
|
-
Url,
|
|
334
|
-
this.token,
|
|
335
|
-
"PATCH",
|
|
336
|
-
data,
|
|
337
|
-
null
|
|
338
|
-
);
|
|
288
|
+
let res = await TFSServices.postRequest(Url, this.token, 'PATCH', data, null);
|
|
339
289
|
return res;
|
|
340
290
|
}
|
|
341
291
|
|
|
342
|
-
async UpdateTestCase(
|
|
343
|
-
projectName: string,
|
|
344
|
-
runId: string,
|
|
345
|
-
state: number
|
|
346
|
-
): Promise<any> {
|
|
292
|
+
async UpdateTestCase(projectName: string, runId: string, state: number): Promise<any> {
|
|
347
293
|
let data: any;
|
|
348
294
|
logger.info(`Update test case, runId : ${runId} to state : ${state}`);
|
|
349
295
|
let Url = `${this.orgUrl}${projectName}/_apis/test/Runs/${runId}/results?api-version=5.0`;
|
|
@@ -353,7 +299,7 @@ export default class TestDataProvider {
|
|
|
353
299
|
data = [
|
|
354
300
|
{
|
|
355
301
|
id: 100000,
|
|
356
|
-
outcome:
|
|
302
|
+
outcome: '0',
|
|
357
303
|
},
|
|
358
304
|
];
|
|
359
305
|
break;
|
|
@@ -362,8 +308,8 @@ export default class TestDataProvider {
|
|
|
362
308
|
data = [
|
|
363
309
|
{
|
|
364
310
|
id: 100000,
|
|
365
|
-
state:
|
|
366
|
-
outcome:
|
|
311
|
+
state: 'Completed',
|
|
312
|
+
outcome: '1',
|
|
367
313
|
},
|
|
368
314
|
];
|
|
369
315
|
break;
|
|
@@ -372,8 +318,8 @@ export default class TestDataProvider {
|
|
|
372
318
|
data = [
|
|
373
319
|
{
|
|
374
320
|
id: 100000,
|
|
375
|
-
state:
|
|
376
|
-
outcome:
|
|
321
|
+
state: 'Completed',
|
|
322
|
+
outcome: '2',
|
|
377
323
|
},
|
|
378
324
|
];
|
|
379
325
|
break;
|
|
@@ -382,19 +328,13 @@ export default class TestDataProvider {
|
|
|
382
328
|
data = [
|
|
383
329
|
{
|
|
384
330
|
id: 100000,
|
|
385
|
-
state:
|
|
386
|
-
outcome:
|
|
331
|
+
state: 'Completed',
|
|
332
|
+
outcome: '3',
|
|
387
333
|
},
|
|
388
334
|
];
|
|
389
335
|
break;
|
|
390
336
|
}
|
|
391
|
-
let res = await TFSServices.postRequest(
|
|
392
|
-
Url,
|
|
393
|
-
this.token,
|
|
394
|
-
"PATCH",
|
|
395
|
-
data,
|
|
396
|
-
null
|
|
397
|
-
);
|
|
337
|
+
let res = await TFSServices.postRequest(Url, this.token, 'PATCH', data, null);
|
|
398
338
|
return res;
|
|
399
339
|
}
|
|
400
340
|
|
|
@@ -414,51 +354,26 @@ export default class TestDataProvider {
|
|
|
414
354
|
comment: comment,
|
|
415
355
|
attachmentType: attachmentType,
|
|
416
356
|
};
|
|
417
|
-
let res = await TFSServices.postRequest(
|
|
418
|
-
Url,
|
|
419
|
-
this.token,
|
|
420
|
-
"Post",
|
|
421
|
-
data,
|
|
422
|
-
null
|
|
423
|
-
);
|
|
357
|
+
let res = await TFSServices.postRequest(Url, this.token, 'Post', data, null);
|
|
424
358
|
return res;
|
|
425
359
|
}
|
|
426
360
|
|
|
427
|
-
async GetTestRunById(
|
|
428
|
-
projectName: string, runId: string
|
|
429
|
-
): Promise<any> {
|
|
361
|
+
async GetTestRunById(projectName: string, runId: string): Promise<any> {
|
|
430
362
|
logger.info(`getting test run id: ${runId}`);
|
|
431
363
|
let url = `${this.orgUrl}${projectName}/_apis/test/Runs/${runId}`;
|
|
432
|
-
let res = await TFSServices.getItemContent(
|
|
433
|
-
url,
|
|
434
|
-
this.token,
|
|
435
|
-
"get",
|
|
436
|
-
null,
|
|
437
|
-
null
|
|
438
|
-
);
|
|
364
|
+
let res = await TFSServices.getItemContent(url, this.token, 'get', null, null);
|
|
439
365
|
return res;
|
|
440
366
|
}
|
|
441
367
|
|
|
442
|
-
async GetTestPointByTestCaseId(
|
|
443
|
-
projectName:
|
|
444
|
-
testCaseId: string
|
|
445
|
-
): Promise<any> {
|
|
446
|
-
logger.info(
|
|
447
|
-
`get test points at project ${projectName} , of testCaseId : ${testCaseId}`
|
|
448
|
-
);
|
|
368
|
+
async GetTestPointByTestCaseId(projectName: string, testCaseId: string): Promise<any> {
|
|
369
|
+
logger.info(`get test points at project ${projectName} , of testCaseId : ${testCaseId}`);
|
|
449
370
|
let url = `${this.orgUrl}${projectName}/_apis/test/points`;
|
|
450
371
|
let data = {
|
|
451
372
|
PointsFilter: {
|
|
452
373
|
TestcaseIds: [testCaseId],
|
|
453
374
|
},
|
|
454
375
|
};
|
|
455
|
-
let res = await TFSServices.postRequest(
|
|
456
|
-
url,
|
|
457
|
-
this.token,
|
|
458
|
-
"Post",
|
|
459
|
-
data,
|
|
460
|
-
null
|
|
461
|
-
);
|
|
376
|
+
let res = await TFSServices.postRequest(url, this.token, 'Post', data, null);
|
|
462
377
|
return res;
|
|
463
378
|
}
|
|
464
379
|
}
|