- Timestamp:
- Dec 23, 2019 2:41:27 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/webui/wuireport.py
r82643 r82646 174 174 def generateReportBody(self): 175 175 self._sTitle = 'Success rate'; 176 fTailoredForGoogleCharts = True; 176 177 177 178 adPeriods = self._oModel.getSuccessRates(); … … 179 180 sReport = ''; 180 181 181 oTable = WuiHlpGraphDataTable(' Period', [ 'Succeeded', 'Skipped', 'Failed' ]);182 oTable = WuiHlpGraphDataTable('When', [ 'Succeeded', 'Skipped', 'Failed' ]); 182 183 183 184 #for i in range(len(adPeriods) - 1, -1, -1): 184 185 for i, dStatuses in enumerate(adPeriods): 185 cSuccess = dStatuses[ReportModelBase.ksTestStatus_Success] + dStatuses[ReportModelBase.ksTestStatus_Skipped]; 186 cTotal = cSuccess + dStatuses[ReportModelBase.ksTestStatus_Failure]; 186 cSuccesses = dStatuses[ReportModelBase.ksTestStatus_Success]; 187 cFailures = dStatuses[ReportModelBase.ksTestStatus_Failure]; 188 cSkipped = dStatuses[ReportModelBase.ksTestStatus_Skipped]; 189 190 cSuccess = cSuccesses + cSkipped; 191 cTotal = cSuccess + cFailures; 187 192 sPeriod = self._oModel.getPeriodDesc(i); 188 if cTotal > 0:193 if fTailoredForGoogleCharts: 189 194 oTable.addRow(sPeriod, 190 [ dStatuses[ReportModelBase.ksTestStatus_Success] * 100 // cTotal, 191 dStatuses[ReportModelBase.ksTestStatus_Skipped] * 100 // cTotal, 192 dStatuses[ReportModelBase.ksTestStatus_Failure] * 100 // cTotal, ], 193 [ self.fmtPctWithHits(dStatuses[ReportModelBase.ksTestStatus_Success], cTotal), 194 self.fmtPctWithHits(dStatuses[ReportModelBase.ksTestStatus_Skipped], cTotal), 195 self.fmtPctWithHits(dStatuses[ReportModelBase.ksTestStatus_Failure], cTotal), ]); 195 [ cSuccesses * 100 // cTotal if cTotal else 0, 196 cSkipped * 100 // cTotal if cTotal else 0, 197 cFailures * 100 // cTotal if cTotal else 0, ], 198 [ self.fmtPct(cSuccesses, cTotal) if cSuccesses else None, 199 self.fmtPct(cSkipped, cTotal) if cSkipped else None, 200 self.fmtPct(cFailures, cTotal) if cFailures else None, ]); 201 196 202 else: 197 oTable.addRow(sPeriod, [ 0, 0, 0 ], [ '0%', '0%', '0%' ]); 203 if cTotal > 0: 204 oTable.addRow(sPeriod, 205 [ cSuccesses * 100 // cTotal, 206 cSkipped * 100 // cTotal, 207 cFailures * 100 // cTotal, ], 208 [ self.fmtPctWithHits(cSuccesses, cTotal), 209 self.fmtPctWithHits(cSkipped, cTotal), 210 self.fmtPctWithHits(cFailures, cTotal), ]); 211 else: 212 oTable.addRow(sPeriod, [ 0, 0, 0 ], [ '0%', '0%', '0%' ]); 198 213 199 214 cTotalNow = adPeriods[0][ReportModelBase.ksTestStatus_Success]; … … 211 226 oGraph.setRangeMax(100); 212 227 sReport += oGraph.renderGraph(); 228 229 # 230 # Graph with absolute counts. 231 # 232 if fTailoredForGoogleCharts: 233 oTable = WuiHlpGraphDataTable(None, [ 'Succeeded', 'Skipped', 'Failed' ]); 234 for i, dStatuses in enumerate(adPeriods): 235 cSuccesses = dStatuses[ReportModelBase.ksTestStatus_Success]; 236 cFailures = dStatuses[ReportModelBase.ksTestStatus_Failure]; 237 cSkipped = dStatuses[ReportModelBase.ksTestStatus_Skipped]; 238 239 oTable.addRow(self._oModel.getPeriodDesc(i), 240 [ cSuccesses, cSkipped, cFailures, ], 241 [ str(cSuccesses) if cSuccesses > 0 else None, 242 str(cSkipped) if cSkipped > 0 else None, 243 str(cFailures) if cFailures > 0 else None, ]); 244 oGraph = WuiHlpBarGraph('success-numbers', oTable, self._oDisp); 245 sReport += oGraph.renderGraph(); 213 246 214 247 return sReport;
Note:
See TracChangeset
for help on using the changeset viewer.