This repository was archived by the owner on Oct 3, 2025. It is now read-only.
forked from jkrooswyk/Test-Status-by-Test-Set
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestStatusperTestSet.html
More file actions
502 lines (460 loc) · 23.6 KB
/
Copy pathTestStatusperTestSet.html
File metadata and controls
502 lines (460 loc) · 23.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<!DOCTYPE html>
<html>
<head>
<title>Test Status per Test Set</title>
<meta name="Name" content="Test Status per Test Set" />
<meta name="Version" content="1.3" />
<meta name="Vendor" content="Rally Software" />
<meta name="Author" content="Joel Krooswyk" />
<script type="text/javascript" src="/apps/2.0p5/sdk-debug.js"></script>
<script type="text/javascript">
// This app finds all test sets created during a given iteration
// A current iteration MUST exist for this app to run
Rally.onReady(function() {
var Ext = window.Ext4 || window.Ext;
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
title: 'Test Status Panel',
items: [
{
xtype: 'container',
itemId: 'iterationFilter'
},
{
xtype: 'container',
layout: 'accordion',
itemId: 'testStatus'
}
],
launch: function() {
this._testSummary = [];
this._testResultList = [];
this._testSetTestList = [];
var TestSetStore;
var TestResultStore;
this.down('#iterationFilter').add({
xtype: 'rallyiterationcombobox',
itemId: 'iterationComboBox',
listeners: {
change: this._queryForTestSets,
ready: this._queryForTestSets,
scope: this
}
});
},
_queryForTestSets: function() {
//if loading new iteration, destroy existing grids
if (this._summaryGrid !== undefined) {
this._summaryGrid.destroy();
this._Grid.destroy();
this._Grid2.destroy();
}
TestSetStore = Ext.create('Rally.data.WsapiDataStore', {
model: 'TestSet',
autoLoad: true,
storeId: 'TestSetStorer',
filters: [{
property: 'Iteration.Name',
operator: '=',
value: this.down('#iterationComboBox').getRecord().data.Name
}],
fetch: [
'FormattedID','Name','TestCases', 'ObjectID', 'Project'
],
listeners: {
load: function(store, data, success) {
this._queryForTestResults(store, data)
},
scope: this
}
});
},
_queryForTestResults: function(mystore, testsetdata) {
that = this;
that._testSetTestList = [];
Ext.Array.each(testsetdata, function(record) {
Ext.Array.each(record.get('TestCases'), function(name, index) {
that._testSetTestList.push({
resID: name.FormattedID,
resName: name.Name,
resObject: name.ObjectID,
resSetID: record.get('FormattedID'),
resSet: record.get('Name'),
resSetObject: record.get('ObjectID'),
resSetProject: name.Project.ObjectID
});
});
});
TestResultStore = Ext.create('Rally.data.WsapiDataStore', {
model: 'TestCaseResult',
autoLoad: true,
storeId: 'TestResultStorer',
filters: [{
property : 'TestSet.Iteration.Name',
operator : '=',
value : this.down('#iterationComboBox').getRecord().data.Name
}],
//sorters: [{
// property: 'TestSet',
// direction: 'ASC'
//}],
fetch: [
'TestSet','FormattedID','TestCase','Date','Verdict','Tester','ObjectID','Project'
],
listeners: {
load: function(store, data, success) {
this._onTestsLoaded(store, data)
},
scope: this
}
});
},
_onTestsLoaded: function(mystore, testrecorddata) {
that = this;
that._testResultList = [];
Ext.Array.each(testrecorddata, function(record) {
var datevar = record.get('Date');
that._testResultList.push({
resID: record.get('TestCase').FormattedID,
resName: record.get('TestCase')._refObjectName,
resObject: record.get('TestCase').ObjectID,
resVerdict: record.get('Verdict'),
resDate: datevar,
resTester: record.get('Tester')._refObjectName,
resSetID: record.get('TestSet').FormattedID,
resSet: record.get('TestSet')._refObjectName,
resSetObject: record.get('TestSet').ObjectID,
resSetProject: record.get('TestSet').Project.ObjectID,
resultID: record.get('ObjectID')
});
});
//Eliminate tests run more than once
resultsDeleteArray = [];
Ext.Array.each(that._testResultList, function(record, index1) {
Ext.Array.each(that._testResultList, function(otherrecord, index2) {
if ((record.resID == otherrecord.resID) && (record.resSetID == otherrecord.resSetID) && (record.resultID != otherrecord.resultID)) {
if (record.resDate > otherrecord.resDate) {
resultsDeleteArray.push(index2);
}
}
});
});
//Remove older items from the results list
resultsDeleteArray.sort();
resultsDeleteArray.reverse();
for (var i=0; i<resultsDeleteArray.length; i++) {
if (resultsDeleteArray[i] == resultsDeleteArray[i+1]) {
resultsDeleteArray.splice(i, 1);
}
}
Ext.Array.each(resultsDeleteArray, function(spliceID) {
that._testResultList.splice(spliceID, 1);
});
//clean up dates in results list
Ext.Array.each(that._testResultList, function(record, index1) {
datevar = record.resDate;
record.resDate = datevar.toDateString();
});
//create test set list
var TestSetList =[];
var testindex = 0;
Ext.Array.each(that._testSetTestList, function(record, index) {
if(index == 0) {
TestSetList.push(record.resSetID);
testindex = 1;
} else {
var val1 = record.resSetID;
var val2 = TestSetList[testindex - 1];
if (val1 !== val2) {
TestSetList.push(record.resSetID);
testindex++;
}
}
});
//create test set objectID list for hotlinking
var TestSetObjList2 =[];
var testindex = 0;
Ext.Array.each(that._testSetTestList, function(record, index) {
if(index == 0) {
TestSetObjList2.push(record.resSetObject);
testindex = 1;
} else {
var val1 = record.resSetObject;
var val2 = TestSetObjList2[testindex - 1];
if (val1 !== val2) {
TestSetObjList2.push(record.resSetObject);
testindex++;
}
}
});
//create test set name list
var TestSetNameList =[];
var testindex = 0;
Ext.Array.each(that._testSetTestList, function(record, index) {
if(index == 0) {
TestSetNameList.push(record.resSet);
testindex = 1;
} else {
var val1 = record.resSet;
var val2 = TestSetNameList[testindex - 1];
var val3 = record.resSetObject;
var val4 = TestSetObjList2[testindex - 1]
if ((val1 !== val2) || (val3 !== val4)) {
TestSetNameList.push(record.resSet);
testindex++;
}
}
});
//create test set project list for hotlinking
var TestSetObjList = [];
var index = TestSetObjList2.length;
i=0;
while (i<index) {
TestSetObjList.push(that._testSetTestList[0].resSetProject)
i++;
}
//obtain counts for each test set
var totalTestSetCounts = [];
var testCounters = 0;
TestSetList.forEach(function(record) {
Ext.Array.each(that._testSetTestList, function(testsetrecord) {
if(record == testsetrecord.resSetID) {
testCounters++;
}
});
totalTestSetCounts.push(testCounters);
testCounters = 0;
});
//console.log(totalTestSetCounts);
//obtain test outcome counts for each test set
var passTestSetCounts = [];
var failTestSetCounts = [];
var otherTestSetCounts =[];
var testPassCounters = 0;
var testFailCounters = 0;
var testOtherCounters = 0;
TestSetList.forEach(function(record) {
Ext.Array.each(that._testResultList, function(testsetrecord) {
if(record == testsetrecord.resSetID) {
if (testsetrecord.resVerdict == "Pass") {
testPassCounters++;
} else if (testsetrecord.resVerdict == "Fail") {
testFailCounters++;
} else {
testOtherCounters++;
}
}
});
passTestSetCounts.push(testPassCounters);
failTestSetCounts.push(testFailCounters);
otherTestSetCounts.push(testOtherCounters);
testPassCounters = 0;
testFailCounters = 0;
testOtherCounters = 0;
});
//Need to find tests already run by looking at current results and comparing to complete list
var DeleteArray = [];
var numTotalTests = that._testSetTestList;
numTotalTests = numTotalTests.length;
Ext.Array.each(that._testResultList, function(record, index1) {
Ext.Array.each(that._testSetTestList, function(otherrecord, index2) {
if ((record.resID == otherrecord.resID) && (record.resSetID == otherrecord.resSetID)) {
DeleteArray.push(index2);
}
});
});
//Remove items from the complete list to just leave unrun tests
DeleteArray.reverse();
Ext.Array.each(DeleteArray, function(spliceID) {
that._testSetTestList.splice(spliceID, 1);
});
//sum total test status
var numTestsNotRun = that._testSetTestList;
numTestsNotRun = numTestsNotRun.length;
testingPercentComplete = 100 - ((passTestSetCounts/numTotalTests)*100);
//get the summary data out there for results
that._testSummary = [];
TestSetList.forEach(function(record, index) {
var percentComplete = (((passTestSetCounts[index] + failTestSetCounts[index] + otherTestSetCounts[index])) / totalTestSetCounts[index]);
var testingPercentPass = (passTestSetCounts[index]/totalTestSetCounts[index]);
that._testSummary.push({
TestSetID: TestSetList[index],
TestSetName: TestSetNameList[index],
Passed: passTestSetCounts[index],
Failed: failTestSetCounts[index],
Other: otherTestSetCounts[index],
Total: totalTestSetCounts[index],
PercentComplete: percentComplete,
PercentPass: testingPercentPass,
ProjectObj: TestSetObjList[index],
TestSetObj: TestSetObjList2[index]
});
});
this._summaryGrid = Ext.create('Rally.ui.grid.Grid', {
xtype: 'rallygrid',
store: Ext.create('Rally.data.custom.Store', {
storeId: 'TestSummaryStore',
data: that._testSummary,
autoScroll: true,
columnLines: true
}),
title: '<B>Test Execution Summary</B>',
//showPagingToolbar: false,
enableEditing: true,
columnCfgs: [
{
text: 'Set ID', dataIndex: 'TestSetID' , flex: 1,
renderer: function(value, meta, record) {
var proj = record.get('ProjectObj');
var setID = record.get('TestSetObj');
var link = "../#/" + proj+ '/detail/testset/' + setID + '/run';
return '<a href="' + link + '"target="_parent">' + value + '</a>';
}
},
{
text: 'Set Name', dataIndex: 'TestSetName', flex: 3
},
{
text: 'EXECUTION',
xtype: 'templatecolumn',
flex: 2,
tpl: Ext.create('Rally.ui.renderer.template.PercentDoneTemplate',
{
percentDoneName: 'PercentComplete'
})
},
{
text: 'PASSING',
xtype: 'templatecolumn',
flex: 2,
tpl: Ext.create('Rally.ui.renderer.template.PercentDoneTemplate',
{
percentDoneName: 'PercentPass'
})
},
{
text: 'Passed', dataIndex: 'Passed', flex: 1
},
{
text: 'Failed', dataIndex: 'Failed', flex: 1
},
{
text: 'Other', dataIndex: 'Other', flex: 1
},
{
text: 'Set Total', dataIndex: 'Total', flex: 1
}
]
});
this.down('#testStatus').add(this._summaryGrid);
//get the data out there for results
this._Grid2 = Ext.create('Rally.ui.grid.Grid', {
xtype: 'rallygrid',
store: Ext.create('Rally.data.custom.Store', {
storeId: 'TestResultsStore',
data: that._testResultList,
autoScroll: true,
columnLines: true
}),
title: '<B>Test Results from this Iteration</B>',
enableEditing: true,
columnCfgs: [
{
text: 'Set ID', dataIndex: 'resSetID' , flex: 1,
renderer: function(value, meta, record) {
var proj = record.get('resSetProject');
var setID = record.get('resSetObject');
var link = "../#/" + proj+ '/detail/testset/' + setID + '/run';
return '<a href="' + link + '"target="_parent">' + value + '</a>';
}
},
{
text: 'Test Set', dataIndex: 'resSet', flex: 2
},
{
text: 'Test ID', dataIndex: 'resID' , flex: 1,
renderer: function(value, meta, record) {
var proj = record.get('resSetProject');
var caseID = record.get('resObject');
var link = "../#/" + proj+ '/detail/testcase/' + caseID;
return '<a href="' + link + '"target="_parent">' + value + '</a>';
}
},
{
text: 'Test Name', dataIndex: 'resName', flex: 2
},
{
text: 'Last Verdict', dataIndex: 'resVerdict', flex: 1,
renderer: function(value, meta, record) {
var newvalue;
if (value === 'Fail') {
newvalue = "<span style='color:red;font-weight:bold' >"+value+"</span>";
} else if (value === 'Pass') {
newvalue = "<span style='color:green;font-weight:bold' >"+value+"</span>";
} else {
newvalue = "<span style='color:gray;font-weight:bold' >"+value+"</span>";
}
return newvalue;
}
},
{
text: 'Tester Name', dataIndex: 'resTester', flex: 2
},
{
text: 'Execution Date', dataIndex: 'resDate', flex: 2
}
]
});
this.down('#testStatus').add(this._Grid2);
//get the data out there for remaining tests to run
this._Grid = Ext.create('Rally.ui.grid.Grid', {
xtype: 'rallygrid',
store: Ext.create('Rally.data.custom.Store', {
storeId: 'TestSetStorer',
data: that._testSetTestList,
autoScroll: true,
columnLines: true
}),
title: '<B>Tests Remaining to Run for this Iteration</B>',
enableEditing: true,
columnCfgs: [
{
text: 'Set ID', dataIndex: 'resSetID' , flex: 1,
renderer: function(value, meta, record) {
var proj = record.get('resSetProject');
var setID = record.get('resSetObject');
var link = "../#/" + proj+ '/detail/testset/' + setID + '/run';
return '<a href="' + link + '"target="_parent">' + value + '</a>';
}
},
{
text: 'Test Set', dataIndex: 'resSet', flex: 2
},
{
text: 'Test ID', dataIndex: 'resID' , flex: 1,
renderer: function(value, meta, record) {
var proj = record.get('resSetProject');
var caseID = record.get('resObject');
var link = "../#/" + proj+ '/detail/testcase/' + caseID;
return '<a href="' + link + '"target="_parent">' + value + '</a>';
}
},
{
text: 'Test Name', dataIndex: 'resName', flex: 2
},
]
});
this.down('#testStatus').add(this._Grid);
}
});
Rally.launchApp('CustomApp', {
name: 'Test Set Results per Iteration'
});
});
</script>
<style type="text/css">
</style>
</head>
<body></body>
</html>