test-reporting 4.2.1__tar.gz → 4.4.0__tar.gz
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.
- {test_reporting-4.2.1 → test_reporting-4.4.0}/PKG-INFO +3 -1
- {test_reporting-4.2.1 → test_reporting-4.4.0}/README.md +2 -0
- test_reporting-4.4.0/reporting/exporters/pdf_exporter.py +337 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/exporters/pptx_exporter.py +99 -24
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/exporters/xlsx_exporter.py +79 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/monthly_report.py +17 -13
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/monthly_ui.py +85 -3
- test_reporting-4.4.0/reporting/pdf_analysis.py +58 -0
- test_reporting-4.4.0/reporting/report_insights.py +35 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/run_source.py +41 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/setup.py +1 -1
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/PKG-INFO +3 -1
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/SOURCES.txt +2 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/tests/test_published_monthly_report.py +54 -1
- test_reporting-4.2.1/reporting/exporters/pdf_exporter.py +0 -492
- {test_reporting-4.2.1 → test_reporting-4.4.0}/LICENSE +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/__init__.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/classifier.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/cli.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/config.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/exporters/__init__.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/plugin.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/publisher.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/storage.py +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/templates/index.html +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/templates/project.html +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/reporting/templates/run.html +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/setup.cfg +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/dependency_links.txt +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/entry_points.txt +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/requires.txt +0 -0
- {test_reporting-4.2.1 → test_reporting-4.4.0}/test_reporting.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: test-reporting
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.0
|
|
4
4
|
Summary: Multi-project test reporting dashboard — collect results locally or push to S3
|
|
5
5
|
Home-page: https://github.com/amahdy77/test-reporting.git
|
|
6
6
|
Author: Ashfaqur Mahdy
|
|
@@ -322,6 +322,8 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
322
322
|
|
|
323
323
|
Generate a report for one project from its published run history. The report reader supports the same local or S3 store used by `test-report publish`; it does not need a copied SQLite database.
|
|
324
324
|
|
|
325
|
+
For Windows AWS SSO sign-in, S3 configuration, and local UI or CLI steps, see [LOCAL_REPORT_GENERATION.md](LOCAL_REPORT_GENERATION.md).
|
|
326
|
+
|
|
325
327
|
### Quick Start
|
|
326
328
|
|
|
327
329
|
```bash
|
|
@@ -281,6 +281,8 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
281
281
|
|
|
282
282
|
Generate a report for one project from its published run history. The report reader supports the same local or S3 store used by `test-report publish`; it does not need a copied SQLite database.
|
|
283
283
|
|
|
284
|
+
For Windows AWS SSO sign-in, S3 configuration, and local UI or CLI steps, see [LOCAL_REPORT_GENERATION.md](LOCAL_REPORT_GENERATION.md).
|
|
285
|
+
|
|
284
286
|
### Quick Start
|
|
285
287
|
|
|
286
288
|
```bash
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"""Stakeholder PDF built from published run summaries and test records."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Dict
|
|
5
|
+
from xml.sax.saxutils import escape
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
from reportlab.graphics.shapes import Circle, Drawing, Line, Rect, String
|
|
9
|
+
from reportlab.lib import colors
|
|
10
|
+
from reportlab.lib.enums import TA_CENTER, TA_LEFT
|
|
11
|
+
from reportlab.lib.pagesizes import A4
|
|
12
|
+
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
|
|
13
|
+
from reportlab.lib.units import inch
|
|
14
|
+
from reportlab.platypus import (
|
|
15
|
+
KeepTogether, LongTable, PageBreak, Paragraph, SimpleDocTemplate,
|
|
16
|
+
Spacer, Table, TableStyle,
|
|
17
|
+
)
|
|
18
|
+
except ImportError as exc:
|
|
19
|
+
raise ImportError(
|
|
20
|
+
"reportlab is required for PDF export. Install with: pip install test-reporting[reports]"
|
|
21
|
+
) from exc
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class PDFExporter:
|
|
25
|
+
"""Present period measures, charts, and a file-to-test breakdown."""
|
|
26
|
+
|
|
27
|
+
def __init__(self):
|
|
28
|
+
self.navy = colors.HexColor('#142B49')
|
|
29
|
+
self.teal = colors.HexColor('#087E83')
|
|
30
|
+
self.red = colors.HexColor('#C0444B')
|
|
31
|
+
self.gold = colors.HexColor('#C58A24')
|
|
32
|
+
self.ink = colors.HexColor('#26374A')
|
|
33
|
+
self.muted = colors.HexColor('#64748B')
|
|
34
|
+
self.light = colors.HexColor('#F3F7FA')
|
|
35
|
+
self.border = colors.HexColor('#DCE5ED')
|
|
36
|
+
styles = getSampleStyleSheet()
|
|
37
|
+
styles['Normal'].fontName = 'Helvetica'
|
|
38
|
+
styles['Normal'].fontSize = 9.5
|
|
39
|
+
styles['Normal'].leading = 14
|
|
40
|
+
styles['Normal'].textColor = self.ink
|
|
41
|
+
self.styles = styles
|
|
42
|
+
self.styles.add(ParagraphStyle(
|
|
43
|
+
name='ReportTitle', parent=styles['Normal'], fontName='Helvetica-Bold',
|
|
44
|
+
fontSize=29, leading=36, textColor=self.navy, spaceAfter=15))
|
|
45
|
+
self.styles.add(ParagraphStyle(
|
|
46
|
+
name='SectionTitle', parent=styles['Normal'], fontName='Helvetica-Bold',
|
|
47
|
+
fontSize=16, leading=20, textColor=self.navy, spaceBefore=10, spaceAfter=9))
|
|
48
|
+
self.styles.add(ParagraphStyle(
|
|
49
|
+
name='SubTitle', parent=styles['Normal'], fontName='Helvetica-Bold',
|
|
50
|
+
fontSize=11, leading=15, textColor=self.teal, spaceBefore=10, spaceAfter=6))
|
|
51
|
+
self.styles.add(ParagraphStyle(
|
|
52
|
+
name='Small', parent=styles['Normal'], fontSize=8, leading=11, textColor=self.muted))
|
|
53
|
+
self.styles.add(ParagraphStyle(
|
|
54
|
+
name='Cell', parent=styles['Normal'], fontSize=8, leading=11, splitLongWords=True))
|
|
55
|
+
self.styles.add(ParagraphStyle(
|
|
56
|
+
name='CellHead', parent=styles['Cell'], fontName='Helvetica-Bold',
|
|
57
|
+
textColor=colors.white))
|
|
58
|
+
self.styles.add(ParagraphStyle(
|
|
59
|
+
name='Center', parent=styles['Normal'], alignment=TA_CENTER))
|
|
60
|
+
|
|
61
|
+
def export(self, metrics: Dict[str, Any], sections: Dict[str, bool],
|
|
62
|
+
report_meta: Dict[str, Any], output_path: Path):
|
|
63
|
+
analysis = metrics['pdf_analysis']
|
|
64
|
+
summary = metrics['summary']
|
|
65
|
+
doc = SimpleDocTemplate(
|
|
66
|
+
str(output_path), pagesize=A4, leftMargin=49, rightMargin=49,
|
|
67
|
+
topMargin=57, bottomMargin=48,
|
|
68
|
+
title=f"Test Execution Report - {report_meta['project']}",
|
|
69
|
+
author='QA Reporting')
|
|
70
|
+
story = self._cover(report_meta, summary, analysis)
|
|
71
|
+
story.append(PageBreak())
|
|
72
|
+
if sections.get('summary', True):
|
|
73
|
+
story.extend(self._overview(metrics, analysis))
|
|
74
|
+
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
75
|
+
story.append(PageBreak())
|
|
76
|
+
story.extend(self._activity(metrics['daily_trends'], summary, analysis))
|
|
77
|
+
if sections.get('failures', True):
|
|
78
|
+
story.append(PageBreak())
|
|
79
|
+
story.extend(self._failure_mix(metrics, analysis))
|
|
80
|
+
if summary.get('detail_complete') and (
|
|
81
|
+
sections.get('file_health', True) or sections.get('failures', True)):
|
|
82
|
+
story.append(PageBreak())
|
|
83
|
+
story.extend(self._file_breakdown(analysis, report_meta['top_n']))
|
|
84
|
+
self._project = report_meta['project']
|
|
85
|
+
self._period = f"{report_meta['start_date']} to {report_meta['end_date']}"
|
|
86
|
+
doc.build(story, onFirstPage=self._page, onLaterPages=self._page)
|
|
87
|
+
|
|
88
|
+
def _page(self, canvas, doc):
|
|
89
|
+
width, height = A4
|
|
90
|
+
canvas.saveState()
|
|
91
|
+
canvas.setFillColor(self.navy)
|
|
92
|
+
canvas.rect(0, height - 12, width, 12, fill=1, stroke=0)
|
|
93
|
+
if doc.page > 1:
|
|
94
|
+
canvas.setFont('Helvetica-Bold', 8)
|
|
95
|
+
canvas.setFillColor(self.navy)
|
|
96
|
+
canvas.drawString(49, height - 34, 'TEST EXECUTION REPORT')
|
|
97
|
+
canvas.setStrokeColor(self.border)
|
|
98
|
+
canvas.line(49, 35, width - 49, 35)
|
|
99
|
+
canvas.setFont('Helvetica', 7.5)
|
|
100
|
+
canvas.setFillColor(self.muted)
|
|
101
|
+
canvas.drawString(49, 22, f'{self._project} | {self._period}'[:95])
|
|
102
|
+
canvas.drawRightString(width - 49, 22, str(doc.page))
|
|
103
|
+
canvas.restoreState()
|
|
104
|
+
|
|
105
|
+
def _p(self, value, style='Normal'):
|
|
106
|
+
return Paragraph(escape(str(value)), self.styles[style])
|
|
107
|
+
|
|
108
|
+
def _heading(self, title, description):
|
|
109
|
+
return [self._p(title, 'SectionTitle'), self._p(description), Spacer(1, 10)]
|
|
110
|
+
|
|
111
|
+
def _table(self, headings, rows, widths):
|
|
112
|
+
values = [[self._p(h, 'CellHead') for h in headings]]
|
|
113
|
+
values.extend([[self._p(cell, 'Cell') for cell in row] for row in rows])
|
|
114
|
+
table = LongTable(values, colWidths=widths, repeatRows=1, hAlign='LEFT')
|
|
115
|
+
table.setStyle(TableStyle([
|
|
116
|
+
('BACKGROUND', (0, 0), (-1, 0), self.navy),
|
|
117
|
+
('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.white, self.light]),
|
|
118
|
+
('LINEBELOW', (0, 0), (-1, 0), 1, self.teal),
|
|
119
|
+
('LINEBELOW', (0, 1), (-1, -1), 0.3, self.border),
|
|
120
|
+
('TOPPADDING', (0, 0), (-1, -1), 7),
|
|
121
|
+
('BOTTOMPADDING', (0, 0), (-1, -1), 7),
|
|
122
|
+
('LEFTPADDING', (0, 0), (-1, -1), 8),
|
|
123
|
+
('RIGHTPADDING', (0, 0), (-1, -1), 8),
|
|
124
|
+
('VALIGN', (0, 0), (-1, -1), 'TOP'),
|
|
125
|
+
]))
|
|
126
|
+
return table
|
|
127
|
+
|
|
128
|
+
def _cover(self, meta, summary, analysis):
|
|
129
|
+
story = [Spacer(1, 1.15 * inch), self._p('QUALITY INTELLIGENCE / PERIOD REVIEW', 'SubTitle'),
|
|
130
|
+
Spacer(1, 12), self._p('Test Execution Report', 'ReportTitle'),
|
|
131
|
+
self._p(meta['project'], 'SubTitle'),
|
|
132
|
+
self._p(f"{meta['start_date']} to {meta['end_date']}"),
|
|
133
|
+
Spacer(1, 0.65 * inch)]
|
|
134
|
+
cards = [
|
|
135
|
+
('PASS RATE', f"{summary['pass_rate']}%"),
|
|
136
|
+
('TEST EXECUTIONS', f"{analysis['total']:,}"),
|
|
137
|
+
('RUNS', f"{summary['total_runs']:,}"),
|
|
138
|
+
]
|
|
139
|
+
card_data = [[self._p(label, 'Small') for label, _ in cards],
|
|
140
|
+
[self._p(value, 'ReportTitle') for _, value in cards]]
|
|
141
|
+
cards_table = Table(card_data, colWidths=[165, 165, 165], hAlign='LEFT')
|
|
142
|
+
cards_table.setStyle(TableStyle([
|
|
143
|
+
('BACKGROUND', (0, 0), (-1, -1), self.light),
|
|
144
|
+
('BOX', (0, 0), (-1, -1), 0.5, self.border),
|
|
145
|
+
('TOPPADDING', (0, 0), (-1, 0), 13),
|
|
146
|
+
('BOTTOMPADDING', (0, -1), (-1, -1), 10),
|
|
147
|
+
('LEFTPADDING', (0, 0), (-1, -1), 12),
|
|
148
|
+
]))
|
|
149
|
+
story.extend([cards_table, Spacer(1, 0.45 * inch),
|
|
150
|
+
self._p('What this report measures', 'SubTitle'),
|
|
151
|
+
self._p('Results from published automated test runs for one project and the selected period. '
|
|
152
|
+
'Pass rate is passed executions divided by all executions, including skipped tests. '
|
|
153
|
+
'These measures describe observed test execution, not product coverage or defect severity.'),
|
|
154
|
+
Spacer(1, 12),
|
|
155
|
+
self._p('Generated from run history; individual test measures appear only when detailed '
|
|
156
|
+
'records cover all passed and failed executions.', 'Small')])
|
|
157
|
+
return story
|
|
158
|
+
|
|
159
|
+
def _overview(self, metrics, analysis):
|
|
160
|
+
summary = metrics['summary']
|
|
161
|
+
story = self._heading('At a glance',
|
|
162
|
+
'The period totals below use published run summaries. A test execution is one recorded test result in one run.')
|
|
163
|
+
for insight in metrics.get('highlights', []):
|
|
164
|
+
story.extend([self._p(insight), Spacer(1, 6)])
|
|
165
|
+
story.append(Spacer(1, 8))
|
|
166
|
+
previous = (f"{summary['previous_pass_rate']}% ({summary['pass_rate_change']:+.1f} points)"
|
|
167
|
+
if summary.get('previous_pass_rate') is not None else 'No earlier runs')
|
|
168
|
+
rows = [
|
|
169
|
+
('Passed executions', f"{analysis['passed']:,}", 'Completed successfully.'),
|
|
170
|
+
('Failed executions', f"{analysis['failed']:,}", 'Recorded as failed by the test runner.'),
|
|
171
|
+
('Skipped executions', f"{analysis['skipped']:,}", 'Did not run to a pass or fail result.'),
|
|
172
|
+
('Failure rate', f"{analysis['failure_rate']}%", 'Failed executions / all test executions.'),
|
|
173
|
+
('Skip rate', f"{analysis['skip_rate']}%", 'Skipped executions / all test executions.'),
|
|
174
|
+
('Runs without failures', f"{analysis['clean_runs']:,} / {summary['total_runs']:,}",
|
|
175
|
+
'Runs with zero recorded failures; skipped tests may still be present.'),
|
|
176
|
+
('Runs without failures rate', f"{analysis['clean_run_rate']}%",
|
|
177
|
+
'Runs without failures / all runs.'),
|
|
178
|
+
('Previous period pass rate', previous,
|
|
179
|
+
'Compared with the immediately preceding period of equal length.'),
|
|
180
|
+
]
|
|
181
|
+
if analysis['unclassified']:
|
|
182
|
+
rows.insert(3, ('Unclassified executions', f"{analysis['unclassified']:,}",
|
|
183
|
+
'Difference between run total and recorded outcome counts.'))
|
|
184
|
+
story.append(self._table(['Measure', 'Value', 'How to read it'], rows, [165, 110, 220]))
|
|
185
|
+
story.extend([Spacer(1, 16), self._p('Execution outcome mix', 'SubTitle'),
|
|
186
|
+
self._p('Share of all test executions by outcome. The denominator includes skipped tests.', 'Small'),
|
|
187
|
+
Spacer(1, 6), self._outcome_chart(analysis)])
|
|
188
|
+
if not summary.get('detail_complete'):
|
|
189
|
+
story.extend([Spacer(1, 12), self._p('Data completeness', 'SubTitle'),
|
|
190
|
+
self._p('Some published runs do not contain full test-level detail. File and test case '
|
|
191
|
+
'rates are omitted; run-level totals remain available.')])
|
|
192
|
+
return story
|
|
193
|
+
|
|
194
|
+
def _outcome_chart(self, analysis):
|
|
195
|
+
chart = Drawing(495, 65)
|
|
196
|
+
total = max(analysis['total'], analysis['passed'] + analysis['failed'] +
|
|
197
|
+
analysis['skipped'], 1)
|
|
198
|
+
x = 0
|
|
199
|
+
for value, color in ((analysis['passed'], self.teal),
|
|
200
|
+
(analysis['failed'], self.red),
|
|
201
|
+
(analysis['skipped'], self.gold),
|
|
202
|
+
(analysis['unclassified'], self.muted)):
|
|
203
|
+
width = 495 * value / total
|
|
204
|
+
if width:
|
|
205
|
+
chart.add(Rect(x, 30, width, 22, fillColor=color, strokeColor=None))
|
|
206
|
+
x += width
|
|
207
|
+
labels = [('Passed', self.teal), ('Failed', self.red), ('Skipped', self.gold)]
|
|
208
|
+
if analysis['unclassified']:
|
|
209
|
+
labels.append(('Unclassified', self.muted))
|
|
210
|
+
for index, (label, color) in enumerate(labels):
|
|
211
|
+
lx = index * (120 if len(labels) == 4 else 145)
|
|
212
|
+
chart.add(Rect(lx, 8, 8, 8, fillColor=color, strokeColor=None))
|
|
213
|
+
chart.add(String(lx + 13, 8, label, fontName='Helvetica', fontSize=8,
|
|
214
|
+
fillColor=self.ink))
|
|
215
|
+
return chart
|
|
216
|
+
|
|
217
|
+
def _activity(self, daily, summary, analysis):
|
|
218
|
+
story = self._heading('Activity and change',
|
|
219
|
+
'Daily charts show active days with published runs. Values are weighted by the number of test executions.')
|
|
220
|
+
rows = [
|
|
221
|
+
('Active days', analysis['active_days'], 'Calendar days with at least one published run.'),
|
|
222
|
+
('Runs per active day', analysis['runs_per_active_day'], 'Total runs / active days.'),
|
|
223
|
+
('Executions per run', analysis['executions_per_run'], 'Total test executions / runs.'),
|
|
224
|
+
('Average run duration', f"{summary['avg_duration']}s", 'Mean recorded duration across runs.'),
|
|
225
|
+
]
|
|
226
|
+
story.append(self._table(['Measure', 'Value', 'How to read it'], rows, [165, 110, 220]))
|
|
227
|
+
shown = daily[-31:]
|
|
228
|
+
if len(daily) > len(shown):
|
|
229
|
+
story.extend([Spacer(1, 8), self._p('Charts show the most recent 31 active days; '
|
|
230
|
+
'period totals above include all selected runs.', 'Small')])
|
|
231
|
+
story.extend([Spacer(1, 16), self._p('Daily pass rate', 'SubTitle'),
|
|
232
|
+
self._p('Passed executions / all executions on each active day.', 'Small'),
|
|
233
|
+
self._series_chart(shown, 'pass_rate', 100, self.teal, '%'),
|
|
234
|
+
Spacer(1, 12), self._p('Daily execution volume', 'SubTitle'),
|
|
235
|
+
self._p('Number of test executions recorded on each active day.', 'Small'),
|
|
236
|
+
self._series_chart(shown, 'total_tests',
|
|
237
|
+
max(row['total_tests'] for row in shown), self.navy, '')])
|
|
238
|
+
return story
|
|
239
|
+
|
|
240
|
+
def _series_chart(self, daily, key, maximum, color, suffix):
|
|
241
|
+
chart = Drawing(495, 160)
|
|
242
|
+
x0, x1, y0, y1 = 39, 490, 25, 145
|
|
243
|
+
maximum = max(maximum, 1)
|
|
244
|
+
for fraction in (0, 0.5, 1):
|
|
245
|
+
y = y0 + (y1 - y0) * fraction
|
|
246
|
+
chart.add(Line(x0, y, x1, y, strokeColor=self.border, strokeWidth=0.6))
|
|
247
|
+
chart.add(String(2, y - 3, f'{maximum * fraction:g}{suffix}',
|
|
248
|
+
fontName='Helvetica', fontSize=7, fillColor=self.muted))
|
|
249
|
+
points = []
|
|
250
|
+
for i, item in enumerate(daily):
|
|
251
|
+
x = x0 + (x1 - x0) * i / max(len(daily) - 1, 1)
|
|
252
|
+
y = y0 + (y1 - y0) * item[key] / maximum
|
|
253
|
+
points.append((x, y))
|
|
254
|
+
if i and key == 'pass_rate':
|
|
255
|
+
chart.add(Line(*points[i - 1], x, y, strokeColor=color, strokeWidth=1.6))
|
|
256
|
+
elif key != 'pass_rate':
|
|
257
|
+
width = min(10, (x1 - x0) / max(len(daily), 1) * 0.65)
|
|
258
|
+
chart.add(Rect(x - width / 2, y0, width, y - y0,
|
|
259
|
+
fillColor=color, strokeColor=None))
|
|
260
|
+
if i == 0 or i == len(daily) - 1 or i % max(1, len(daily) // 6) == 0:
|
|
261
|
+
chart.add(String(x - 12, 8, item['date'][5:], fontName='Helvetica',
|
|
262
|
+
fontSize=6.8, fillColor=self.muted))
|
|
263
|
+
if key == 'pass_rate':
|
|
264
|
+
for x, y in points:
|
|
265
|
+
chart.add(Circle(x, y, 2.3, fillColor=color, strokeColor=None))
|
|
266
|
+
return chart
|
|
267
|
+
|
|
268
|
+
def _failure_mix(self, metrics, analysis):
|
|
269
|
+
story = self._heading('Failures and their distribution',
|
|
270
|
+
'Failure categories come from recorded test-level details. They are shown only when those '
|
|
271
|
+
'details cover all passed and failed executions.')
|
|
272
|
+
if not metrics['summary'].get('detail_complete'):
|
|
273
|
+
story.append(self._p('Detailed test history is incomplete, so failure categories and '
|
|
274
|
+
'test-level comparisons are not reported.'))
|
|
275
|
+
return story
|
|
276
|
+
failure_types = metrics.get('failure_types', [])
|
|
277
|
+
if not failure_types:
|
|
278
|
+
story.append(self._p('No failed test executions were recorded in this period.'))
|
|
279
|
+
return story
|
|
280
|
+
story.append(self._p('Failure types', 'SubTitle'))
|
|
281
|
+
story.append(self._p('Count of failed test executions in each recorded category.', 'Small'))
|
|
282
|
+
story.append(Spacer(1, 8))
|
|
283
|
+
story.append(self._category_chart(failure_types[:8]))
|
|
284
|
+
story.append(Spacer(1, 8))
|
|
285
|
+
story.append(self._table(['Failure type', 'Failed executions', 'Share of classified failures'],
|
|
286
|
+
[(item['type'], item['count'], f"{item['percentage']}%")
|
|
287
|
+
for item in failure_types], [230, 125, 140]))
|
|
288
|
+
story.extend([Spacer(1, 14), self._p('Where failures occurred', 'SubTitle'),
|
|
289
|
+
self._p('Files below are ranked by failed executions. Full file and test case names '
|
|
290
|
+
'appear in the next section.', 'Small')])
|
|
291
|
+
top_files = analysis['files'][:10]
|
|
292
|
+
story.append(self._table(['Test file', 'Failed', 'Executions', 'Pass rate'],
|
|
293
|
+
[(row['name'], row['failed'], row['executions'],
|
|
294
|
+
f"{row['pass_rate']}%") for row in top_files],
|
|
295
|
+
[300, 55, 70, 70]))
|
|
296
|
+
return story
|
|
297
|
+
|
|
298
|
+
def _category_chart(self, failure_types):
|
|
299
|
+
height = max(70, 26 * len(failure_types) + 10)
|
|
300
|
+
chart = Drawing(495, height)
|
|
301
|
+
maximum = max(item['count'] for item in failure_types) or 1
|
|
302
|
+
for index, item in enumerate(failure_types):
|
|
303
|
+
y = height - 25 - index * 26
|
|
304
|
+
label = str(item['type'])
|
|
305
|
+
if len(label) > 24:
|
|
306
|
+
label = label[:21] + '...'
|
|
307
|
+
chart.add(String(0, y + 5, label, fontName='Helvetica',
|
|
308
|
+
fontSize=8, fillColor=self.ink))
|
|
309
|
+
chart.add(Rect(160, y, 275 * item['count'] / maximum, 13,
|
|
310
|
+
fillColor=self.red, strokeColor=None))
|
|
311
|
+
chart.add(String(445, y + 3, str(item['count']), fontName='Helvetica-Bold',
|
|
312
|
+
fontSize=8, fillColor=self.ink))
|
|
313
|
+
return chart
|
|
314
|
+
|
|
315
|
+
def _file_breakdown(self, analysis, top_n):
|
|
316
|
+
limit = max(1, top_n)
|
|
317
|
+
files = analysis['files'][:limit]
|
|
318
|
+
story = self._heading('Test files and test cases',
|
|
319
|
+
f'Files are ranked by failed executions. Showing {len(files)} of {len(analysis["files"])} '
|
|
320
|
+
'files, with up to 8 cases per file. Cases are ranked by failed executions. '
|
|
321
|
+
'Every displayed name is complete and may wrap onto multiple lines.')
|
|
322
|
+
if not files:
|
|
323
|
+
story.append(self._p('No named test-level records are available.'))
|
|
324
|
+
return story
|
|
325
|
+
for file in files:
|
|
326
|
+
title = self._p(file['name'], 'SubTitle')
|
|
327
|
+
summary = self._p(
|
|
328
|
+
f"{file['case_count']} distinct cases | {file['executions']} executions | "
|
|
329
|
+
f"{file['passed']} passed | {file['failed']} failed | "
|
|
330
|
+
f"{file['skipped']} skipped | {file['pass_rate']}% pass rate", 'Small')
|
|
331
|
+
cases = file['cases'][:8]
|
|
332
|
+
table = self._table(['Test case', 'Passed', 'Failed', 'Skipped', 'Pass rate'],
|
|
333
|
+
[(case['name'], case['passed'], case['failed'],
|
|
334
|
+
case['skipped'], f"{case['pass_rate']}%") for case in cases],
|
|
335
|
+
[285, 50, 50, 55, 55])
|
|
336
|
+
story.extend([KeepTogether([title, summary, Spacer(1, 6)]), table, Spacer(1, 12)])
|
|
337
|
+
return story
|
|
@@ -11,6 +11,7 @@ try:
|
|
|
11
11
|
from pptx.chart.data import CategoryChartData
|
|
12
12
|
from pptx.enum.chart import XL_CHART_TYPE
|
|
13
13
|
from pptx.dml.color import RGBColor
|
|
14
|
+
from pptx.enum.shapes import MSO_SHAPE
|
|
14
15
|
except ImportError:
|
|
15
16
|
raise ImportError(
|
|
16
17
|
"python-pptx is required for PowerPoint export. "
|
|
@@ -29,6 +30,10 @@ class PowerPointExporter:
|
|
|
29
30
|
'blue': RGBColor(49, 130, 206),
|
|
30
31
|
'gray': RGBColor(113, 128, 150)
|
|
31
32
|
}
|
|
33
|
+
self.navy = RGBColor(20, 43, 73)
|
|
34
|
+
self.teal = RGBColor(8, 126, 131)
|
|
35
|
+
self.light = RGBColor(244, 248, 251)
|
|
36
|
+
self.ink = RGBColor(38, 55, 74)
|
|
32
37
|
|
|
33
38
|
def export(
|
|
34
39
|
self,
|
|
@@ -47,7 +52,7 @@ class PowerPointExporter:
|
|
|
47
52
|
|
|
48
53
|
# Slide 2: Executive Summary
|
|
49
54
|
if sections.get('summary', True):
|
|
50
|
-
self._add_summary_slide(prs, metrics['summary'])
|
|
55
|
+
self._add_summary_slide(prs, metrics['summary'], metrics.get('highlights', []))
|
|
51
56
|
|
|
52
57
|
# Slide 3: Pass Rate Trend
|
|
53
58
|
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
@@ -85,6 +90,7 @@ class PowerPointExporter:
|
|
|
85
90
|
if sections.get('recommendations', True) and metrics.get('recommendations'):
|
|
86
91
|
self._add_recommendations_slide(prs, metrics['recommendations'])
|
|
87
92
|
|
|
93
|
+
self._polish_deck(prs, report_meta)
|
|
88
94
|
prs.save(str(output_path))
|
|
89
95
|
|
|
90
96
|
def _add_title_slide(self, prs, report_meta, metrics):
|
|
@@ -94,7 +100,7 @@ class PowerPointExporter:
|
|
|
94
100
|
# Title
|
|
95
101
|
title_box = slide.shapes.add_textbox(Inches(1), Inches(2), Inches(8), Inches(1))
|
|
96
102
|
title_frame = title_box.text_frame
|
|
97
|
-
title_frame.text = "
|
|
103
|
+
title_frame.text = "Test Execution Report"
|
|
98
104
|
title_para = title_frame.paragraphs[0]
|
|
99
105
|
title_para.font.size = Pt(44)
|
|
100
106
|
title_para.font.bold = True
|
|
@@ -133,13 +139,13 @@ class PowerPointExporter:
|
|
|
133
139
|
|
|
134
140
|
label_box = slide.shapes.add_textbox(Inches(3.5), Inches(6), Inches(3), Inches(0.4))
|
|
135
141
|
label_frame = label_box.text_frame
|
|
136
|
-
label_frame.text = "Health
|
|
142
|
+
label_frame.text = "Test Execution Health"
|
|
137
143
|
label_para = label_frame.paragraphs[0]
|
|
138
144
|
label_para.font.size = Pt(16)
|
|
139
145
|
label_para.alignment = PP_ALIGN.CENTER
|
|
140
146
|
label_para.font.color.rgb = self.colors['gray']
|
|
141
147
|
|
|
142
|
-
def _add_summary_slide(self, prs, summary):
|
|
148
|
+
def _add_summary_slide(self, prs, summary, highlights):
|
|
143
149
|
"""Add executive summary slide."""
|
|
144
150
|
slide = prs.slides.add_slide(prs.slide_layouts[5]) # Title only
|
|
145
151
|
|
|
@@ -155,7 +161,7 @@ class PowerPointExporter:
|
|
|
155
161
|
]
|
|
156
162
|
|
|
157
163
|
x_start = 1
|
|
158
|
-
y_pos =
|
|
164
|
+
y_pos = 1.5
|
|
159
165
|
box_width = 1.8
|
|
160
166
|
box_height = 1.5
|
|
161
167
|
spacing = 0.2
|
|
@@ -182,27 +188,96 @@ class PowerPointExporter:
|
|
|
182
188
|
label_para.alignment = PP_ALIGN.CENTER
|
|
183
189
|
label_para.font.color.rgb = self.colors['gray']
|
|
184
190
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
f"Trend: {summary['trend']}",
|
|
194
|
-
f"Avg Duration: {summary['avg_duration']}s per run"
|
|
195
|
-
]
|
|
196
|
-
|
|
197
|
-
y_text = 4.5
|
|
198
|
-
for text in additional:
|
|
199
|
-
text_box = slide.shapes.add_textbox(Inches(1), Inches(y_text), Inches(8), Inches(0.3))
|
|
191
|
+
label = slide.shapes.add_textbox(Inches(1), Inches(3.25), Inches(8), Inches(0.35))
|
|
192
|
+
label.text_frame.text = 'KEY FINDINGS'
|
|
193
|
+
label.text_frame.paragraphs[0].font.size = Pt(12)
|
|
194
|
+
label.text_frame.paragraphs[0].font.bold = True
|
|
195
|
+
label.text_frame.paragraphs[0].font.color.rgb = self.teal
|
|
196
|
+
y_text = 3.7
|
|
197
|
+
for finding in highlights[:4]:
|
|
198
|
+
text_box = slide.shapes.add_textbox(Inches(1), Inches(y_text), Inches(8), Inches(0.68))
|
|
200
199
|
text_frame = text_box.text_frame
|
|
201
|
-
text_frame.
|
|
200
|
+
text_frame.word_wrap = True
|
|
201
|
+
text_frame.text = finding
|
|
202
202
|
text_para = text_frame.paragraphs[0]
|
|
203
|
-
text_para.font.size = Pt(
|
|
204
|
-
text_para.
|
|
205
|
-
y_text += 0.
|
|
203
|
+
text_para.font.size = Pt(15)
|
|
204
|
+
text_para.font.color.rgb = self.ink
|
|
205
|
+
y_text += 0.72
|
|
206
|
+
note = slide.shapes.add_textbox(Inches(1), Inches(6.68), Inches(8), Inches(0.28))
|
|
207
|
+
note.text_frame.text = 'Execution health reflects test outcomes, not coverage or defect severity.'
|
|
208
|
+
note.text_frame.paragraphs[0].font.size = Pt(9)
|
|
209
|
+
note.text_frame.paragraphs[0].font.color.rgb = self.colors['gray']
|
|
210
|
+
|
|
211
|
+
def _polish_deck(self, prs, report_meta):
|
|
212
|
+
"""Apply one restrained visual system to every slide."""
|
|
213
|
+
for number, slide in enumerate(prs.slides, 1):
|
|
214
|
+
cover = number == 1
|
|
215
|
+
slide.background.fill.solid()
|
|
216
|
+
slide.background.fill.fore_color.rgb = self.navy if cover else self.light
|
|
217
|
+
|
|
218
|
+
bar = slide.shapes.add_shape(
|
|
219
|
+
MSO_SHAPE.RECTANGLE, Inches(0), Inches(0),
|
|
220
|
+
prs.slide_width, Inches(0.09))
|
|
221
|
+
bar.fill.solid()
|
|
222
|
+
bar.fill.fore_color.rgb = self.teal
|
|
223
|
+
bar.line.fill.background()
|
|
224
|
+
|
|
225
|
+
if cover:
|
|
226
|
+
for shape in slide.shapes:
|
|
227
|
+
if not shape.has_text_frame or shape == bar:
|
|
228
|
+
continue
|
|
229
|
+
for paragraph in shape.text_frame.paragraphs:
|
|
230
|
+
if shape.left < Inches(2) and shape.top < Inches(3):
|
|
231
|
+
paragraph.font.color.rgb = RGBColor(255, 255, 255)
|
|
232
|
+
elif paragraph.font.color.rgb == self.colors['gray']:
|
|
233
|
+
paragraph.font.color.rgb = RGBColor(193, 211, 224)
|
|
234
|
+
continue
|
|
235
|
+
|
|
236
|
+
if slide.shapes.title:
|
|
237
|
+
title = slide.shapes.title
|
|
238
|
+
title.left, title.top = Inches(0.6), Inches(0.35)
|
|
239
|
+
title.width, title.height = Inches(8.8), Inches(0.65)
|
|
240
|
+
paragraph = title.text_frame.paragraphs[0]
|
|
241
|
+
paragraph.font.name = 'Aptos Display'
|
|
242
|
+
paragraph.font.size = Pt(27)
|
|
243
|
+
paragraph.font.bold = True
|
|
244
|
+
paragraph.font.color.rgb = self.navy
|
|
245
|
+
|
|
246
|
+
for shape in slide.shapes:
|
|
247
|
+
if shape.has_chart:
|
|
248
|
+
chart = shape.chart
|
|
249
|
+
chart.chart_style = 10
|
|
250
|
+
if chart.chart_type == XL_CHART_TYPE.LINE:
|
|
251
|
+
chart.series[0].format.line.color.rgb = self.teal
|
|
252
|
+
chart.series[0].format.line.width = Pt(2.5)
|
|
253
|
+
elif chart.chart_type == XL_CHART_TYPE.COLUMN_STACKED:
|
|
254
|
+
for series, color in zip(chart.series, [self.teal, self.colors['red']]):
|
|
255
|
+
series.format.fill.solid()
|
|
256
|
+
series.format.fill.fore_color.rgb = color
|
|
257
|
+
if not shape.has_table:
|
|
258
|
+
continue
|
|
259
|
+
table = shape.table
|
|
260
|
+
for row_index, row in enumerate(table.rows):
|
|
261
|
+
for cell in row.cells:
|
|
262
|
+
cell.fill.solid()
|
|
263
|
+
cell.fill.fore_color.rgb = (
|
|
264
|
+
self.navy if row_index == 0 else
|
|
265
|
+
RGBColor(255, 255, 255) if row_index % 2 else self.light)
|
|
266
|
+
cell.margin_left = Inches(0.12)
|
|
267
|
+
cell.margin_right = Inches(0.08)
|
|
268
|
+
for paragraph in cell.text_frame.paragraphs:
|
|
269
|
+
paragraph.font.name = 'Aptos'
|
|
270
|
+
paragraph.font.color.rgb = (
|
|
271
|
+
RGBColor(255, 255, 255) if row_index == 0 else self.ink)
|
|
272
|
+
|
|
273
|
+
footer = slide.shapes.add_textbox(
|
|
274
|
+
Inches(0.6), Inches(7.14), Inches(8.8), Inches(0.23))
|
|
275
|
+
footer.text_frame.text = (
|
|
276
|
+
f"{report_meta['project']} | {report_meta['start_date']}–"
|
|
277
|
+
f"{report_meta['end_date']} {number:02d}"
|
|
278
|
+
)
|
|
279
|
+
footer.text_frame.paragraphs[0].font.size = Pt(9)
|
|
280
|
+
footer.text_frame.paragraphs[0].font.color.rgb = self.colors['gray']
|
|
206
281
|
|
|
207
282
|
def _add_trend_slide(self, prs, daily_trends):
|
|
208
283
|
"""Add pass rate trend chart."""
|
|
@@ -79,7 +79,86 @@ class ExcelExporter:
|
|
|
79
79
|
if sections.get('recommendations', True) and metrics.get('recommendations'):
|
|
80
80
|
self._create_recommendations_sheet(wb, metrics['recommendations'])
|
|
81
81
|
|
|
82
|
+
self._polish_workbook(wb, metrics, report_meta)
|
|
82
83
|
wb.save(str(output_path))
|
|
84
|
+
|
|
85
|
+
def _polish_workbook(self, wb, metrics, report_meta):
|
|
86
|
+
"""Make the summary scannable and detail tabs usable for analysis."""
|
|
87
|
+
navy, teal, light, ink = '142B49', '087E83', 'F4F8FB', '26374A'
|
|
88
|
+
for ws in wb.worksheets:
|
|
89
|
+
ws.sheet_view.showGridLines = False
|
|
90
|
+
ws.sheet_properties.pageSetUpPr.fitToPage = True
|
|
91
|
+
ws.page_setup.fitToWidth = 1
|
|
92
|
+
ws.sheet_properties.tabColor = teal if ws.title == 'Summary' else navy
|
|
93
|
+
if ws.title == 'Summary':
|
|
94
|
+
continue
|
|
95
|
+
ws.freeze_panes = 'B2'
|
|
96
|
+
ws.auto_filter.ref = f'A1:{get_column_letter(ws.max_column)}{ws.max_row}'
|
|
97
|
+
ws.row_dimensions[1].height = 30
|
|
98
|
+
for cell in ws[1]:
|
|
99
|
+
cell.fill = PatternFill('solid', fgColor=navy)
|
|
100
|
+
cell.font = Font(name='Aptos', size=11, bold=True, color='FFFFFF')
|
|
101
|
+
cell.alignment = Alignment(vertical='center', horizontal='left')
|
|
102
|
+
for row in ws.iter_rows(min_row=2):
|
|
103
|
+
for cell in row:
|
|
104
|
+
if cell.value is None:
|
|
105
|
+
continue
|
|
106
|
+
cell.font = Font(name='Aptos', size=10, color=ink)
|
|
107
|
+
cell.alignment = Alignment(vertical='center')
|
|
108
|
+
if cell.fill.patternType is None and cell.row % 2 == 0:
|
|
109
|
+
cell.fill = PatternFill('solid', fgColor=light)
|
|
110
|
+
ws.print_options.horizontalCentered = True
|
|
111
|
+
ws.print_title_rows = '1:1'
|
|
112
|
+
|
|
113
|
+
if 'Summary' not in wb:
|
|
114
|
+
return
|
|
115
|
+
ws = wb['Summary']
|
|
116
|
+
ws.merge_cells('A1:D2')
|
|
117
|
+
ws['A1'] = 'TEST EXECUTION REPORT'
|
|
118
|
+
ws['A1'].fill = PatternFill('solid', fgColor=navy)
|
|
119
|
+
ws['A1'].font = Font(name='Aptos Display', size=22, bold=True, color='FFFFFF')
|
|
120
|
+
ws['A1'].alignment = Alignment(vertical='center', indent=1)
|
|
121
|
+
ws.row_dimensions[1].height = 27
|
|
122
|
+
ws.row_dimensions[2].height = 20
|
|
123
|
+
ws.column_dimensions['A'].width = 29
|
|
124
|
+
ws.column_dimensions['B'].width = 32
|
|
125
|
+
ws.column_dimensions['C'].width = 24
|
|
126
|
+
ws.column_dimensions['D'].width = 24
|
|
127
|
+
for row in (3, 4, 5):
|
|
128
|
+
ws[f'A{row}'].font = Font(name='Aptos', size=10, color='64748B', bold=True)
|
|
129
|
+
ws[f'B{row}'].font = Font(name='Aptos', size=10, color=ink)
|
|
130
|
+
ws.merge_cells('A7:D7')
|
|
131
|
+
ws['A7'].fill = PatternFill('solid', fgColor=teal)
|
|
132
|
+
ws['A7'].font = Font(name='Aptos', size=12, bold=True, color='FFFFFF')
|
|
133
|
+
ws['A7'].alignment = Alignment(vertical='center', indent=1)
|
|
134
|
+
ws.row_dimensions[7].height = 26
|
|
135
|
+
for row in range(8, 22):
|
|
136
|
+
ws.row_dimensions[row].height = 23
|
|
137
|
+
ws[f'A{row}'].font = Font(name='Aptos', size=10, color='64748B', bold=True)
|
|
138
|
+
ws[f'B{row}'].font = Font(name='Aptos', size=11, color=ink, bold=True)
|
|
139
|
+
if row % 2 == 0:
|
|
140
|
+
ws[f'A{row}'].fill = PatternFill('solid', fgColor=light)
|
|
141
|
+
if ws[f'B{row}'].fill.patternType is None:
|
|
142
|
+
ws[f'B{row}'].fill = PatternFill('solid', fgColor=light)
|
|
143
|
+
ws.merge_cells('A24:D24')
|
|
144
|
+
ws['A24'] = 'KEY FINDINGS'
|
|
145
|
+
ws['A24'].fill = PatternFill('solid', fgColor=teal)
|
|
146
|
+
ws['A24'].font = Font(name='Aptos', size=12, bold=True, color='FFFFFF')
|
|
147
|
+
ws['A24'].alignment = Alignment(vertical='center', indent=1)
|
|
148
|
+
ws.row_dimensions[24].height = 26
|
|
149
|
+
for row, finding in enumerate(metrics.get('highlights', []), 25):
|
|
150
|
+
ws.merge_cells(start_row=row, start_column=1, end_row=row, end_column=4)
|
|
151
|
+
cell = ws.cell(row, 1, finding)
|
|
152
|
+
cell.font = Font(name='Aptos', size=11, color=ink)
|
|
153
|
+
cell.alignment = Alignment(wrap_text=True, vertical='center', indent=1)
|
|
154
|
+
cell.fill = PatternFill('solid', fgColor=light if row % 2 else 'FFFFFF')
|
|
155
|
+
ws.row_dimensions[row].height = 36
|
|
156
|
+
note_row = max(30, 26 + len(metrics.get('highlights', [])))
|
|
157
|
+
ws.merge_cells(start_row=note_row, start_column=1, end_row=note_row, end_column=4)
|
|
158
|
+
note = ws.cell(note_row, 1, 'Execution health reflects test outcomes, not coverage or defect severity.')
|
|
159
|
+
note.font = Font(name='Aptos', size=9, italic=True, color='64748B')
|
|
160
|
+
ws.freeze_panes = 'A8'
|
|
161
|
+
ws.print_area = f'A1:D{note_row}'
|
|
83
162
|
|
|
84
163
|
def _create_summary_sheet(self, wb, summary, report_meta):
|
|
85
164
|
"""Create summary sheet with key metrics."""
|