test-reporting 4.4.1__tar.gz → 4.4.3__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.4.1/test_reporting.egg-info → test_reporting-4.4.3}/PKG-INFO +4 -34
- {test_reporting-4.4.1 → test_reporting-4.4.3}/README.md +3 -33
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/__init__.py +1 -1
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/cli.py +8 -7
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/config.py +0 -9
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/exporters/pdf_exporter.py +89 -15
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/exporters/pptx_exporter.py +0 -28
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/exporters/xlsx_exporter.py +0 -20
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/monthly_report.py +41 -178
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/monthly_ui.py +2 -2
- {test_reporting-4.4.1 → test_reporting-4.4.3}/setup.py +1 -1
- {test_reporting-4.4.1 → test_reporting-4.4.3/test_reporting.egg-info}/PKG-INFO +4 -34
- {test_reporting-4.4.1 → test_reporting-4.4.3}/tests/test_published_monthly_report.py +36 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/LICENSE +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/classifier.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/exporters/__init__.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/pdf_analysis.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/plugin.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/publisher.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/report_insights.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/run_source.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/storage.py +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/templates/index.html +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/templates/project.html +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/reporting/templates/run.html +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/setup.cfg +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/test_reporting.egg-info/SOURCES.txt +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/test_reporting.egg-info/dependency_links.txt +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/test_reporting.egg-info/entry_points.txt +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/test_reporting.egg-info/requires.txt +0 -0
- {test_reporting-4.4.1 → test_reporting-4.4.3}/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.4.
|
|
3
|
+
Version: 4.4.3
|
|
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
|
|
@@ -260,7 +260,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
260
260
|
| `test-report suites` | Show suite statistics (reads local SQLite) |
|
|
261
261
|
| `test-report cleanup` | Delete old runs from local SQLite |
|
|
262
262
|
| `test-report cleanup-artifacts` | Delete old screenshots and traces (preserves data) |
|
|
263
|
-
| `test-report monthly-report` | Generate
|
|
263
|
+
| `test-report monthly-report` | Generate a project report (PDF default; PPTX/XLSX optional) |
|
|
264
264
|
| `test-report monthly-ui` | Open local project and date picker for reports |
|
|
265
265
|
|
|
266
266
|
### Cleaning up old data
|
|
@@ -320,39 +320,9 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
320
320
|
|
|
321
321
|
## Monthly Reports
|
|
322
322
|
|
|
323
|
-
Generate a report for one project from its published run history.
|
|
323
|
+
Generate a report for one project from its published S3 or local run history. PDF is the default stakeholder report; PowerPoint and Excel are optional exports. The local UI offers rolling date presets, all published history, and custom dates. Reports are downloaded locally and do not change the publishing pipeline.
|
|
324
324
|
|
|
325
|
-
For
|
|
326
|
-
|
|
327
|
-
### Quick Start
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# Install with report dependencies and S3 support
|
|
331
|
-
pip install test-reporting[s3,reports]
|
|
332
|
-
|
|
333
|
-
# Open the local project and date picker
|
|
334
|
-
test-report monthly-ui --config reporting.ini
|
|
335
|
-
|
|
336
|
-
# Generate without the UI (defaults to the last 30 days)
|
|
337
|
-
test-report monthly-report --project "My Project" --format pptx,xlsx,pdf
|
|
338
|
-
|
|
339
|
-
# Custom date range
|
|
340
|
-
test-report monthly-report --project "My Project" --start 2026-08-01 --end 2026-08-31 --format xlsx
|
|
341
|
-
|
|
342
|
-
# Specific project
|
|
343
|
-
test-report monthly-report --project "My Project" --format pptx
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### Features
|
|
347
|
-
|
|
348
|
-
- 📊 Executive summary with health score
|
|
349
|
-
- 📈 Pass rate trends and test volume charts
|
|
350
|
-
- 🔥 Failure hotspots and flaky test detection
|
|
351
|
-
- 🐌 Slowest tests and performance regressions
|
|
352
|
-
- 📁 File health report
|
|
353
|
-
- 💡 Actionable recommendations
|
|
354
|
-
|
|
355
|
-
**See [REPORT_GENERATOR.md](REPORT_GENERATOR.md) for setup and metric definitions.**
|
|
325
|
+
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
356
326
|
|
|
357
327
|
---
|
|
358
328
|
|
|
@@ -219,7 +219,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
219
219
|
| `test-report suites` | Show suite statistics (reads local SQLite) |
|
|
220
220
|
| `test-report cleanup` | Delete old runs from local SQLite |
|
|
221
221
|
| `test-report cleanup-artifacts` | Delete old screenshots and traces (preserves data) |
|
|
222
|
-
| `test-report monthly-report` | Generate
|
|
222
|
+
| `test-report monthly-report` | Generate a project report (PDF default; PPTX/XLSX optional) |
|
|
223
223
|
| `test-report monthly-ui` | Open local project and date picker for reports |
|
|
224
224
|
|
|
225
225
|
### Cleaning up old data
|
|
@@ -279,39 +279,9 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
279
279
|
|
|
280
280
|
## Monthly Reports
|
|
281
281
|
|
|
282
|
-
Generate a report for one project from its published run history.
|
|
282
|
+
Generate a report for one project from its published S3 or local run history. PDF is the default stakeholder report; PowerPoint and Excel are optional exports. The local UI offers rolling date presets, all published history, and custom dates. Reports are downloaded locally and do not change the publishing pipeline.
|
|
283
283
|
|
|
284
|
-
For
|
|
285
|
-
|
|
286
|
-
### Quick Start
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
# Install with report dependencies and S3 support
|
|
290
|
-
pip install test-reporting[s3,reports]
|
|
291
|
-
|
|
292
|
-
# Open the local project and date picker
|
|
293
|
-
test-report monthly-ui --config reporting.ini
|
|
294
|
-
|
|
295
|
-
# Generate without the UI (defaults to the last 30 days)
|
|
296
|
-
test-report monthly-report --project "My Project" --format pptx,xlsx,pdf
|
|
297
|
-
|
|
298
|
-
# Custom date range
|
|
299
|
-
test-report monthly-report --project "My Project" --start 2026-08-01 --end 2026-08-31 --format xlsx
|
|
300
|
-
|
|
301
|
-
# Specific project
|
|
302
|
-
test-report monthly-report --project "My Project" --format pptx
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Features
|
|
306
|
-
|
|
307
|
-
- 📊 Executive summary with health score
|
|
308
|
-
- 📈 Pass rate trends and test volume charts
|
|
309
|
-
- 🔥 Failure hotspots and flaky test detection
|
|
310
|
-
- 🐌 Slowest tests and performance regressions
|
|
311
|
-
- 📁 File health report
|
|
312
|
-
- 💡 Actionable recommendations
|
|
313
|
-
|
|
314
|
-
**See [REPORT_GENERATOR.md](REPORT_GENERATOR.md) for setup and metric definitions.**
|
|
284
|
+
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
315
285
|
|
|
316
286
|
---
|
|
317
287
|
|
|
@@ -362,12 +362,12 @@ def monthly_report():
|
|
|
362
362
|
parser.add_argument('--start', help='Start date (YYYY-MM-DD)')
|
|
363
363
|
parser.add_argument('--end', help='End date (YYYY-MM-DD)')
|
|
364
364
|
parser.add_argument('--project', required=True, help='One published project name')
|
|
365
|
-
parser.add_argument('--
|
|
366
|
-
|
|
367
|
-
parser.add_argument('--format', '--formats', dest='formats', default='pptx',
|
|
368
|
-
help='Output format(s): pptx, xlsx, pdf (comma-separated)')
|
|
365
|
+
parser.add_argument('--format', '--formats', dest='formats', default='pdf',
|
|
366
|
+
help='Output format(s): pdf, pptx, xlsx (comma-separated; default: pdf)')
|
|
369
367
|
parser.add_argument('--output', help='Output directory (default: ./reports)')
|
|
370
368
|
parser.add_argument('--top-n', type=int, default=10, help='Number of items in top N lists')
|
|
369
|
+
parser.add_argument('--report-type', choices=['detailed', 'executive'], default='detailed',
|
|
370
|
+
help='Detailed report or PDF-only executive summary (default: detailed)')
|
|
371
371
|
parser.add_argument('--config', default='reporting.ini', help='Config file path')
|
|
372
372
|
|
|
373
373
|
args = parser.parse_args(sys.argv[2:])
|
|
@@ -402,14 +402,15 @@ def monthly_report():
|
|
|
402
402
|
print(f"[Monthly Report] Formats: {', '.join(formats)}")
|
|
403
403
|
|
|
404
404
|
# Generate report
|
|
405
|
-
generator = MonthlyReportGenerator(config
|
|
405
|
+
generator = MonthlyReportGenerator(config)
|
|
406
406
|
files = generator.generate(
|
|
407
407
|
start_date=start_date,
|
|
408
408
|
end_date=end_date,
|
|
409
409
|
project=args.project,
|
|
410
410
|
formats=formats,
|
|
411
411
|
top_n=args.top_n,
|
|
412
|
-
output_dir=output_dir
|
|
412
|
+
output_dir=output_dir,
|
|
413
|
+
report_type=args.report_type
|
|
413
414
|
)
|
|
414
415
|
|
|
415
416
|
print(f"\n[Monthly Report] Generated {len(files)} file(s):")
|
|
@@ -442,7 +443,7 @@ def main():
|
|
|
442
443
|
'suites': (show_suites, 'Show statistics for all test suites'),
|
|
443
444
|
'cleanup': (cleanup_old_data, 'Clean up old data from local SQLite'),
|
|
444
445
|
'cleanup-artifacts': (cleanup_artifacts, 'Clean up old screenshots and traces'),
|
|
445
|
-
'monthly-report': (monthly_report, 'Generate
|
|
446
|
+
'monthly-report': (monthly_report, 'Generate a project report (PDF default; PPTX/XLSX optional)'),
|
|
446
447
|
'monthly-ui': (monthly_ui, 'Open local project and date picker for reports'),
|
|
447
448
|
}
|
|
448
449
|
|
|
@@ -55,11 +55,6 @@ class ReportingConfig:
|
|
|
55
55
|
or None
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
# Monthly report settings
|
|
59
|
-
monthly_section = self.config['monthly_report'] if 'monthly_report' in self.config else {}
|
|
60
|
-
self.REPORT_PERIOD_DAYS = int(monthly_section.get('report_period_days', 30))
|
|
61
|
-
self.REPORT_TOP_N = int(monthly_section.get('top_n_items', 10))
|
|
62
|
-
|
|
63
58
|
def _load_from_defaults(self):
|
|
64
59
|
self.PROJECT_NAME = os.getenv('PROJECT_NAME', 'test-automation-project')
|
|
65
60
|
|
|
@@ -86,10 +81,6 @@ class ReportingConfig:
|
|
|
86
81
|
|
|
87
82
|
self.REGRESSION_TAG = os.getenv('REGRESSION_TAG') or None
|
|
88
83
|
|
|
89
|
-
# Monthly report defaults
|
|
90
|
-
self.REPORT_PERIOD_DAYS = 30
|
|
91
|
-
self.REPORT_TOP_N = 10
|
|
92
|
-
|
|
93
84
|
# Timeout thresholds (ms)
|
|
94
85
|
TIMEOUT_UI_WARNING = 30000
|
|
95
86
|
TIMEOUT_UI_MAX = 60000
|
|
@@ -62,27 +62,32 @@ class PDFExporter:
|
|
|
62
62
|
report_meta: Dict[str, Any], output_path: Path):
|
|
63
63
|
analysis = metrics['pdf_analysis']
|
|
64
64
|
summary = metrics['summary']
|
|
65
|
+
executive = report_meta.get('report_type') == 'executive'
|
|
65
66
|
doc = SimpleDocTemplate(
|
|
66
67
|
str(output_path), pagesize=A4, leftMargin=49, rightMargin=49,
|
|
67
68
|
topMargin=57, bottomMargin=48,
|
|
68
|
-
title=f"Test Execution Report - {report_meta['project']}",
|
|
69
|
+
title=f"{'Executive Summary' if executive else 'Test Execution Report'} - {report_meta['project']}",
|
|
69
70
|
author='QA Reporting')
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
story
|
|
74
|
-
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
71
|
+
if executive:
|
|
72
|
+
story = self._executive_summary(metrics, report_meta, analysis)
|
|
73
|
+
else:
|
|
74
|
+
story = self._cover(report_meta, summary, analysis)
|
|
75
75
|
story.append(PageBreak())
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
if sections.get('summary', True):
|
|
77
|
+
story.extend(self._overview(metrics, analysis))
|
|
78
|
+
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
79
|
+
story.append(PageBreak())
|
|
80
|
+
story.extend(self._activity(metrics['daily_trends'], summary, analysis))
|
|
81
|
+
if sections.get('failures', True):
|
|
82
|
+
story.append(PageBreak())
|
|
83
|
+
story.extend(self._failure_mix(metrics, analysis))
|
|
84
|
+
if summary.get('detail_complete') and (
|
|
85
|
+
sections.get('file_health', True) or sections.get('failures', True)):
|
|
86
|
+
story.append(PageBreak())
|
|
87
|
+
story.extend(self._file_breakdown(analysis, report_meta['top_n']))
|
|
84
88
|
self._project = report_meta['project']
|
|
85
89
|
self._period = f"{report_meta['start_date']} to {report_meta['end_date']}"
|
|
90
|
+
self._running_title = 'EXECUTIVE SUMMARY' if executive else 'TEST EXECUTION REPORT'
|
|
86
91
|
doc.build(story, onFirstPage=self._page, onLaterPages=self._page)
|
|
87
92
|
|
|
88
93
|
def _page(self, canvas, doc):
|
|
@@ -93,7 +98,7 @@ class PDFExporter:
|
|
|
93
98
|
if doc.page > 1:
|
|
94
99
|
canvas.setFont('Helvetica-Bold', 8)
|
|
95
100
|
canvas.setFillColor(self.navy)
|
|
96
|
-
canvas.drawString(49, height - 34,
|
|
101
|
+
canvas.drawString(49, height - 34, self._running_title)
|
|
97
102
|
canvas.setStrokeColor(self.border)
|
|
98
103
|
canvas.line(49, 35, width - 49, 35)
|
|
99
104
|
canvas.setFont('Helvetica', 7.5)
|
|
@@ -125,6 +130,75 @@ class PDFExporter:
|
|
|
125
130
|
]))
|
|
126
131
|
return table
|
|
127
132
|
|
|
133
|
+
def _executive_summary(self, metrics, meta, analysis):
|
|
134
|
+
summary = metrics['summary']
|
|
135
|
+
story = [
|
|
136
|
+
self._p('QUALITY INTELLIGENCE / PERIOD REVIEW', 'SubTitle'),
|
|
137
|
+
self._p('Executive Summary', 'ReportTitle'),
|
|
138
|
+
self._p(meta['project'], 'SubTitle'),
|
|
139
|
+
self._p(f"{meta['start_date']} to {meta['end_date']}"),
|
|
140
|
+
Spacer(1, 17),
|
|
141
|
+
]
|
|
142
|
+
cards = [
|
|
143
|
+
('PASS RATE', f"{summary['pass_rate']}%"),
|
|
144
|
+
('TEST EXECUTIONS', f"{analysis['total']:,}"),
|
|
145
|
+
('PUBLISHED RUNS', f"{summary['total_runs']:,}"),
|
|
146
|
+
]
|
|
147
|
+
card_data = [[self._p(label, 'Small') for label, _ in cards],
|
|
148
|
+
[self._p(value, 'ReportTitle') for _, value in cards]]
|
|
149
|
+
card_table = Table(card_data, colWidths=[165, 165, 165], hAlign='LEFT')
|
|
150
|
+
card_table.setStyle(TableStyle([
|
|
151
|
+
('BACKGROUND', (0, 0), (-1, -1), self.light),
|
|
152
|
+
('BOX', (0, 0), (-1, -1), 0.5, self.border),
|
|
153
|
+
('LEFTPADDING', (0, 0), (-1, -1), 12),
|
|
154
|
+
('TOPPADDING', (0, 0), (-1, 0), 11),
|
|
155
|
+
('BOTTOMPADDING', (0, 1), (-1, 1), 8),
|
|
156
|
+
]))
|
|
157
|
+
story.extend([card_table, Spacer(1, 14)])
|
|
158
|
+
previous = ('No earlier runs' if summary['previous_pass_rate'] is None else
|
|
159
|
+
f"{summary['pass_rate_change']:+.1f} points vs {summary['previous_pass_rate']}% previously")
|
|
160
|
+
rows = [
|
|
161
|
+
('Previous period', previous),
|
|
162
|
+
('Failed / skipped', f"{analysis['failed']:,} / {analysis['skipped']:,} executions"),
|
|
163
|
+
('Runs without failures',
|
|
164
|
+
f"{analysis['clean_runs']:,} of {summary['total_runs']:,} ({analysis['clean_run_rate']}%)"),
|
|
165
|
+
('Activity', f"{analysis['active_days']:,} active days; "
|
|
166
|
+
f"{analysis['runs_per_active_day']} runs per active day"),
|
|
167
|
+
('Average run duration', f"{summary['avg_duration']} seconds"),
|
|
168
|
+
]
|
|
169
|
+
if summary.get('detail_complete'):
|
|
170
|
+
distinct_cases = sum(file['case_count'] for file in analysis['files'])
|
|
171
|
+
rows.append(('Distinct test cases observed', f'{distinct_cases:,} in selected runs'))
|
|
172
|
+
if metrics.get('failure_types'):
|
|
173
|
+
leading = metrics['failure_types'][0]
|
|
174
|
+
rows.append(('Most common failure type',
|
|
175
|
+
f"{leading['type']} ({leading['count']:,} failed executions)"))
|
|
176
|
+
story.extend([
|
|
177
|
+
self._p('At a glance', 'SectionTitle'),
|
|
178
|
+
self._table(['Measure', 'Period result'], rows, [160, 335]),
|
|
179
|
+
Spacer(1, 13),
|
|
180
|
+
self._p('Execution outcomes', 'SubTitle'),
|
|
181
|
+
self._p('Passed, failed and skipped shares of all recorded executions.', 'Small'),
|
|
182
|
+
Spacer(1, 4), self._outcome_chart(analysis),
|
|
183
|
+
])
|
|
184
|
+
daily = metrics.get('daily_trends', [])[-12:]
|
|
185
|
+
if len(daily) > 1:
|
|
186
|
+
story.extend([
|
|
187
|
+
Spacer(1, 8), self._p('Recent active days: pass rate', 'SubTitle'),
|
|
188
|
+
self._p('Most recent 12 active days; period totals above include every selected run.', 'Small'),
|
|
189
|
+
self._series_chart(daily, 'pass_rate', 100, self.teal, '%'),
|
|
190
|
+
])
|
|
191
|
+
story.extend([Spacer(1, 9), self._p('Key observations', 'SubTitle')])
|
|
192
|
+
for insight in metrics.get('highlights', [])[:3]:
|
|
193
|
+
story.extend([self._p(insight), Spacer(1, 4)])
|
|
194
|
+
if not summary.get('detail_complete'):
|
|
195
|
+
story.extend([Spacer(1, 4), self._p(
|
|
196
|
+
'Some run files lack full test-level detail. Test-specific observations are omitted.', 'Small')])
|
|
197
|
+
story.extend([Spacer(1, 5), self._p(
|
|
198
|
+
'Source: published automated test runs for this project and period. '
|
|
199
|
+
'Execution results do not measure product or automation coverage.', 'Small')])
|
|
200
|
+
return story
|
|
201
|
+
|
|
128
202
|
def _cover(self, meta, summary, analysis):
|
|
129
203
|
story = [Spacer(1, 1.15 * inch), self._p('QUALITY INTELLIGENCE / PERIOD REVIEW', 'SubTitle'),
|
|
130
204
|
Spacer(1, 12), self._p('Test Execution Report', 'ReportTitle'),
|
|
@@ -86,10 +86,6 @@ class PowerPointExporter:
|
|
|
86
86
|
if sections.get('file_health', True) and metrics.get('file_health'):
|
|
87
87
|
self._add_file_health_slide(prs, metrics['file_health'][:10])
|
|
88
88
|
|
|
89
|
-
# Slide 11: Recommendations
|
|
90
|
-
if sections.get('recommendations', True) and metrics.get('recommendations'):
|
|
91
|
-
self._add_recommendations_slide(prs, metrics['recommendations'])
|
|
92
|
-
|
|
93
89
|
self._polish_deck(prs, report_meta)
|
|
94
90
|
prs.save(str(output_path))
|
|
95
91
|
|
|
@@ -500,30 +496,6 @@ class PowerPointExporter:
|
|
|
500
496
|
for j in range(3):
|
|
501
497
|
table.cell(i, j).text_frame.paragraphs[0].font.size = Pt(10)
|
|
502
498
|
|
|
503
|
-
def _add_recommendations_slide(self, prs, recommendations):
|
|
504
|
-
"""Add recommendations slide."""
|
|
505
|
-
slide = prs.slides.add_slide(prs.slide_layouts[5])
|
|
506
|
-
|
|
507
|
-
title = slide.shapes.title
|
|
508
|
-
title.text = "Recommendations"
|
|
509
|
-
|
|
510
|
-
# Add recommendations as bullet points
|
|
511
|
-
left = Inches(1)
|
|
512
|
-
top = Inches(2)
|
|
513
|
-
width = Inches(8)
|
|
514
|
-
height = Inches(4.5)
|
|
515
|
-
|
|
516
|
-
text_box = slide.shapes.add_textbox(left, top, width, height)
|
|
517
|
-
text_frame = text_box.text_frame
|
|
518
|
-
text_frame.word_wrap = True
|
|
519
|
-
|
|
520
|
-
for rec in recommendations:
|
|
521
|
-
p = text_frame.add_paragraph()
|
|
522
|
-
p.text = rec
|
|
523
|
-
p.font.size = Pt(14)
|
|
524
|
-
p.level = 0
|
|
525
|
-
p.space_after = Pt(12)
|
|
526
|
-
|
|
527
499
|
def _get_health_color(self, score):
|
|
528
500
|
"""Get color based on health score."""
|
|
529
501
|
if score >= 95:
|
|
@@ -75,10 +75,6 @@ class ExcelExporter:
|
|
|
75
75
|
if sections.get('file_health', True) and metrics.get('file_health'):
|
|
76
76
|
self._create_file_health_sheet(wb, metrics['file_health'])
|
|
77
77
|
|
|
78
|
-
# Sheet 9: Recommendations
|
|
79
|
-
if sections.get('recommendations', True) and metrics.get('recommendations'):
|
|
80
|
-
self._create_recommendations_sheet(wb, metrics['recommendations'])
|
|
81
|
-
|
|
82
78
|
self._polish_workbook(wb, metrics, report_meta)
|
|
83
79
|
wb.save(str(output_path))
|
|
84
80
|
|
|
@@ -464,22 +460,6 @@ class ExcelExporter:
|
|
|
464
460
|
for col in ['C', 'D', 'E', 'F']:
|
|
465
461
|
ws.column_dimensions[col].width = 15
|
|
466
462
|
|
|
467
|
-
def _create_recommendations_sheet(self, wb, recommendations):
|
|
468
|
-
"""Create recommendations sheet."""
|
|
469
|
-
ws = wb.create_sheet("Recommendations")
|
|
470
|
-
|
|
471
|
-
# Title
|
|
472
|
-
ws['A1'] = "Recommendations"
|
|
473
|
-
ws['A1'].font = Font(size=16, bold=True)
|
|
474
|
-
|
|
475
|
-
# Recommendations
|
|
476
|
-
for row, rec in enumerate(recommendations, 3):
|
|
477
|
-
ws[f'A{row}'] = f"{row - 2}. {rec}"
|
|
478
|
-
ws[f'A{row}'].alignment = Alignment(wrap_text=True, vertical='top')
|
|
479
|
-
|
|
480
|
-
# Format
|
|
481
|
-
ws.column_dimensions['A'].width = 100
|
|
482
|
-
|
|
483
463
|
def _get_health_fill(self, score):
|
|
484
464
|
"""Get fill color based on health score."""
|
|
485
465
|
if score >= 95:
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
Monthly Report Generator
|
|
3
3
|
Generates comprehensive monthly test reports in multiple formats (PPTX, XLSX, PDF).
|
|
4
4
|
"""
|
|
5
|
-
import json
|
|
6
5
|
from datetime import date, datetime, timedelta
|
|
7
6
|
from pathlib import Path
|
|
8
7
|
from typing import Dict, Any, List, Optional
|
|
9
8
|
from collections import defaultdict
|
|
10
9
|
|
|
11
10
|
from .config import ReportingConfig
|
|
12
|
-
from .storage import TestResultStorage
|
|
13
11
|
from .run_source import PublishedRunSource
|
|
14
12
|
from .report_insights import build_highlights
|
|
15
13
|
|
|
@@ -17,11 +15,9 @@ from .report_insights import build_highlights
|
|
|
17
15
|
class MonthlyReportGenerator:
|
|
18
16
|
"""Generates monthly test reports with metrics and visualizations."""
|
|
19
17
|
|
|
20
|
-
def __init__(self, config: Optional[ReportingConfig] = None,
|
|
18
|
+
def __init__(self, config: Optional[ReportingConfig] = None, run_source=None):
|
|
21
19
|
self.config = config or ReportingConfig()
|
|
22
|
-
self.source = source
|
|
23
20
|
self.run_source = run_source or PublishedRunSource(self.config)
|
|
24
|
-
self.storage = TestResultStorage(config=self.config) if source == 'sqlite' else None
|
|
25
21
|
|
|
26
22
|
def generate(
|
|
27
23
|
self,
|
|
@@ -31,8 +27,8 @@ class MonthlyReportGenerator:
|
|
|
31
27
|
formats: List[str] = None,
|
|
32
28
|
sections: Dict[str, bool] = None,
|
|
33
29
|
top_n: int = 10,
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
output_dir: Optional[Path] = None,
|
|
31
|
+
report_type: str = 'detailed'
|
|
36
32
|
) -> List[Path]:
|
|
37
33
|
"""
|
|
38
34
|
Generate monthly report in specified formats.
|
|
@@ -44,23 +40,25 @@ class MonthlyReportGenerator:
|
|
|
44
40
|
formats: List of formats to generate ['pptx', 'xlsx', 'pdf']
|
|
45
41
|
sections: Dict of section names to include/exclude
|
|
46
42
|
top_n: Number of items to show in top N lists
|
|
47
|
-
chart_theme: Chart theme ('light' or 'dark')
|
|
48
43
|
output_dir: Output directory (defaults to temp)
|
|
44
|
+
report_type: 'detailed' or 'executive' (PDF only)
|
|
49
45
|
|
|
50
46
|
Returns:
|
|
51
47
|
List of generated file paths
|
|
52
48
|
"""
|
|
53
|
-
if self.source not in ('published', 'sqlite'):
|
|
54
|
-
raise ValueError(f'Unknown report source: {self.source}')
|
|
55
49
|
start = date.fromisoformat(start_date)
|
|
56
50
|
end = date.fromisoformat(end_date)
|
|
57
51
|
if start > end:
|
|
58
52
|
raise ValueError('Start date must be on or before end date')
|
|
59
53
|
if not project:
|
|
60
54
|
raise ValueError('Select one project for the report')
|
|
61
|
-
formats = formats or ['
|
|
55
|
+
formats = formats or ['pdf']
|
|
62
56
|
if not set(formats) <= {'pptx', 'xlsx', 'pdf'}:
|
|
63
57
|
raise ValueError('Formats must be pptx, xlsx, or pdf')
|
|
58
|
+
if report_type not in {'detailed', 'executive'}:
|
|
59
|
+
raise ValueError('Report type must be detailed or executive')
|
|
60
|
+
if report_type == 'executive' and formats != ['pdf']:
|
|
61
|
+
raise ValueError('Executive summary is available as PDF only')
|
|
64
62
|
sections = sections or {}
|
|
65
63
|
output_dir = output_dir or Path.cwd() / 'reports'
|
|
66
64
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -100,7 +98,7 @@ class MonthlyReportGenerator:
|
|
|
100
98
|
'project': project or 'All Projects',
|
|
101
99
|
'generated_at': datetime.now().isoformat(),
|
|
102
100
|
'top_n': top_n,
|
|
103
|
-
'
|
|
101
|
+
'report_type': report_type,
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
# Generate each format
|
|
@@ -129,6 +127,8 @@ class MonthlyReportGenerator:
|
|
|
129
127
|
from .pdf_analysis import build_pdf_analysis
|
|
130
128
|
exporter = PDFExporter()
|
|
131
129
|
filename = self._make_filename(start_date, end_date, project, 'pdf')
|
|
130
|
+
if report_type == 'executive':
|
|
131
|
+
filename = filename.replace('monthly-report_', 'executive-summary_', 1)
|
|
132
132
|
output_path = output_dir / filename
|
|
133
133
|
metrics['pdf_analysis'] = build_pdf_analysis(data)
|
|
134
134
|
exporter.export(metrics, sections, report_meta, output_path)
|
|
@@ -144,93 +144,36 @@ class MonthlyReportGenerator:
|
|
|
144
144
|
return f"monthly-report_{project_part}{start_date}_to_{end_date}.{ext}"
|
|
145
145
|
|
|
146
146
|
def collect_data(self, start_date: str, end_date: str, project: Optional[str] = None) -> Dict[str, Any]:
|
|
147
|
-
"""Collect test results from published run files
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for t in run.get('failed_tests', [])
|
|
156
|
-
}
|
|
157
|
-
tests = run.get('all_tests')
|
|
158
|
-
if tests is None:
|
|
159
|
-
tests = run.get('passed_tests', []) + run.get('failed_tests', [])
|
|
160
|
-
for test in tests:
|
|
161
|
-
status = test.get('status')
|
|
162
|
-
if not status:
|
|
163
|
-
status = 'failed' if (test.get('test_name'), test.get('file_name')) in failed_details else 'passed'
|
|
164
|
-
detail = failed_details.get((test.get('test_name'), test.get('file_name')), {})
|
|
165
|
-
results.append({
|
|
166
|
-
'run_id': index,
|
|
167
|
-
'test_name': test.get('test_name'),
|
|
168
|
-
'file_name': test.get('file_name'),
|
|
169
|
-
'status': status,
|
|
170
|
-
'duration_seconds': test.get('duration_seconds') or 0,
|
|
171
|
-
'failure_type': test.get('failure_type') or detail.get('failure_type'),
|
|
172
|
-
'is_soft_fail': detail.get('is_soft_fail', False),
|
|
173
|
-
'created_at': run.get('timestamp', ''),
|
|
174
|
-
})
|
|
175
|
-
runs.sort(key=lambda r: r.get('timestamp', ''))
|
|
176
|
-
return {'runs': runs, 'results': results, 'start_date': start_date,
|
|
177
|
-
'end_date': end_date, 'project': project}
|
|
178
|
-
return self._collect_sqlite_data(start_date, end_date, project)
|
|
179
|
-
|
|
180
|
-
def _collect_sqlite_data(self, start_date, end_date, project):
|
|
181
|
-
"""Read the legacy local database when explicitly requested."""
|
|
182
|
-
import sqlite3
|
|
183
|
-
|
|
184
|
-
conn = sqlite3.connect(self.storage.db_path)
|
|
185
|
-
conn.row_factory = sqlite3.Row
|
|
186
|
-
|
|
187
|
-
try:
|
|
188
|
-
# Build WHERE clause
|
|
189
|
-
where_clauses = [
|
|
190
|
-
"timestamp >= ?",
|
|
191
|
-
"timestamp <= ?"
|
|
192
|
-
]
|
|
193
|
-
params = [start_date, end_date + 'T23:59:59']
|
|
194
|
-
|
|
195
|
-
if project:
|
|
196
|
-
where_clauses.append("project_name = ?")
|
|
197
|
-
params.append(project)
|
|
198
|
-
|
|
199
|
-
where_clause = " AND ".join(where_clauses)
|
|
200
|
-
|
|
201
|
-
# Get all runs in date range
|
|
202
|
-
runs_query = f"""
|
|
203
|
-
SELECT * FROM test_runs
|
|
204
|
-
WHERE {where_clause}
|
|
205
|
-
ORDER BY timestamp ASC
|
|
206
|
-
"""
|
|
207
|
-
runs_cursor = conn.execute(runs_query, params)
|
|
208
|
-
runs = [dict(row) for row in runs_cursor.fetchall()]
|
|
209
|
-
|
|
210
|
-
# Get all test results for these runs
|
|
211
|
-
if runs:
|
|
212
|
-
run_ids = [r['id'] for r in runs]
|
|
213
|
-
placeholders = ','.join('?' * len(run_ids))
|
|
214
|
-
results_query = f"""
|
|
215
|
-
SELECT * FROM test_results
|
|
216
|
-
WHERE run_id IN ({placeholders})
|
|
217
|
-
ORDER BY run_id, id
|
|
218
|
-
"""
|
|
219
|
-
results_cursor = conn.execute(results_query, run_ids)
|
|
220
|
-
results = [dict(row) for row in results_cursor.fetchall()]
|
|
221
|
-
else:
|
|
222
|
-
results = []
|
|
223
|
-
|
|
224
|
-
return {
|
|
225
|
-
'runs': runs,
|
|
226
|
-
'results': results,
|
|
227
|
-
'start_date': start_date,
|
|
228
|
-
'end_date': end_date,
|
|
229
|
-
'project': project
|
|
147
|
+
"""Collect test results from published run files."""
|
|
148
|
+
runs = []
|
|
149
|
+
results = []
|
|
150
|
+
for index, run in enumerate(self.run_source.runs(project, start_date, end_date), 1):
|
|
151
|
+
runs.append({**run, 'id': index})
|
|
152
|
+
failed_details = {
|
|
153
|
+
(t.get('test_name'), t.get('file_name')): t
|
|
154
|
+
for t in run.get('failed_tests', [])
|
|
230
155
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
156
|
+
tests = run.get('all_tests')
|
|
157
|
+
if tests is None:
|
|
158
|
+
tests = run.get('passed_tests', []) + run.get('failed_tests', [])
|
|
159
|
+
for test in tests:
|
|
160
|
+
status = test.get('status')
|
|
161
|
+
if not status:
|
|
162
|
+
status = 'failed' if (test.get('test_name'), test.get('file_name')) in failed_details else 'passed'
|
|
163
|
+
detail = failed_details.get((test.get('test_name'), test.get('file_name')), {})
|
|
164
|
+
results.append({
|
|
165
|
+
'run_id': index,
|
|
166
|
+
'test_name': test.get('test_name'),
|
|
167
|
+
'file_name': test.get('file_name'),
|
|
168
|
+
'status': status,
|
|
169
|
+
'duration_seconds': test.get('duration_seconds') or 0,
|
|
170
|
+
'failure_type': test.get('failure_type') or detail.get('failure_type'),
|
|
171
|
+
'is_soft_fail': detail.get('is_soft_fail', False),
|
|
172
|
+
'created_at': run.get('timestamp', ''),
|
|
173
|
+
})
|
|
174
|
+
runs.sort(key=lambda r: r.get('timestamp', ''))
|
|
175
|
+
return {'runs': runs, 'results': results, 'start_date': start_date,
|
|
176
|
+
'end_date': end_date, 'project': project}
|
|
234
177
|
|
|
235
178
|
def calculate_metrics(self, data: Dict[str, Any], top_n: int = 10) -> Dict[str, Any]:
|
|
236
179
|
"""Calculate all metrics from collected data."""
|
|
@@ -240,11 +183,6 @@ class MonthlyReportGenerator:
|
|
|
240
183
|
if not runs:
|
|
241
184
|
return self._empty_metrics()
|
|
242
185
|
|
|
243
|
-
# Group results by run_id
|
|
244
|
-
results_by_run = defaultdict(list)
|
|
245
|
-
for result in results:
|
|
246
|
-
results_by_run[result['run_id']].append(result)
|
|
247
|
-
|
|
248
186
|
# Calculate summary metrics
|
|
249
187
|
summary = self._calculate_summary(runs, results)
|
|
250
188
|
|
|
@@ -267,11 +205,6 @@ class MonthlyReportGenerator:
|
|
|
267
205
|
# Calculate file health
|
|
268
206
|
file_health = self._calculate_file_health(results)
|
|
269
207
|
|
|
270
|
-
# Generate recommendations
|
|
271
|
-
recommendations = self._generate_recommendations(
|
|
272
|
-
summary, failure_hotspots, flaky_tests, slowest_tests
|
|
273
|
-
)
|
|
274
|
-
|
|
275
208
|
# Older published files may only contain selected test details. Never
|
|
276
209
|
# present test-level rates or trends as complete when records are missing.
|
|
277
210
|
if not summary['detail_complete']:
|
|
@@ -279,8 +212,6 @@ class MonthlyReportGenerator:
|
|
|
279
212
|
slowest_tests = []
|
|
280
213
|
performance_regressions = []
|
|
281
214
|
file_health = []
|
|
282
|
-
recommendations = self._generate_recommendations(summary, failure_hotspots, [], [])
|
|
283
|
-
recommendations.insert(0, 'Detailed test history is incomplete for this period; test-level analysis is omitted.')
|
|
284
215
|
|
|
285
216
|
return {
|
|
286
217
|
'summary': summary,
|
|
@@ -291,7 +222,6 @@ class MonthlyReportGenerator:
|
|
|
291
222
|
'slowest_tests': slowest_tests,
|
|
292
223
|
'performance_regressions': performance_regressions,
|
|
293
224
|
'file_health': file_health,
|
|
294
|
-
'recommendations': recommendations
|
|
295
225
|
}
|
|
296
226
|
|
|
297
227
|
def _empty_metrics(self) -> Dict[str, Any]:
|
|
@@ -311,7 +241,6 @@ class MonthlyReportGenerator:
|
|
|
311
241
|
'slowest_tests': [],
|
|
312
242
|
'performance_regressions': [],
|
|
313
243
|
'file_health': [],
|
|
314
|
-
'recommendations': []
|
|
315
244
|
}
|
|
316
245
|
|
|
317
246
|
def _calculate_summary(self, runs: List[Dict], results: List[Dict]) -> Dict[str, Any]:
|
|
@@ -599,69 +528,3 @@ class MonthlyReportGenerator:
|
|
|
599
528
|
|
|
600
529
|
file_health.sort(key=lambda x: x['pass_rate']) # Worst first
|
|
601
530
|
return file_health
|
|
602
|
-
|
|
603
|
-
def _generate_recommendations(
|
|
604
|
-
self,
|
|
605
|
-
summary: Dict,
|
|
606
|
-
failure_hotspots: List[Dict],
|
|
607
|
-
flaky_tests: List[Dict],
|
|
608
|
-
slowest_tests: List[Dict]
|
|
609
|
-
) -> List[str]:
|
|
610
|
-
"""Generate actionable recommendations based on metrics."""
|
|
611
|
-
recommendations = []
|
|
612
|
-
|
|
613
|
-
# Health-based recommendations
|
|
614
|
-
health_score = summary.get('health_score', 0)
|
|
615
|
-
if health_score < 80:
|
|
616
|
-
recommendations.append(
|
|
617
|
-
f"Critical: Test health score is {health_score}%. "
|
|
618
|
-
"Review the most frequent failures and confirm their causes."
|
|
619
|
-
)
|
|
620
|
-
elif health_score < 95:
|
|
621
|
-
recommendations.append(
|
|
622
|
-
f"Watch: Test health score is {health_score}%. "
|
|
623
|
-
"Focus on reducing failures to reach 95%+ target."
|
|
624
|
-
)
|
|
625
|
-
else:
|
|
626
|
-
recommendations.append(
|
|
627
|
-
f"Strong result: Test health score is {health_score}%. "
|
|
628
|
-
"Continue monitoring the pass rate and failure mix."
|
|
629
|
-
)
|
|
630
|
-
|
|
631
|
-
# Failure hotspot recommendations
|
|
632
|
-
if len(failure_hotspots) > 0:
|
|
633
|
-
top_3 = failure_hotspots[:3]
|
|
634
|
-
recommendations.append(
|
|
635
|
-
f"Investigate the top {len(top_3)} recorded failure hotspots: " +
|
|
636
|
-
", ".join(f"{h['test_name']} ({h['failure_count']} failures)" for h in top_3)
|
|
637
|
-
)
|
|
638
|
-
|
|
639
|
-
# Flaky test recommendations
|
|
640
|
-
if len(flaky_tests) > 0:
|
|
641
|
-
recommendations.append(
|
|
642
|
-
f"Investigate {len(flaky_tests)} tests that both passed and failed across runs. "
|
|
643
|
-
"Check whether failures come from the product, environment, or test code."
|
|
644
|
-
)
|
|
645
|
-
|
|
646
|
-
# Performance recommendations
|
|
647
|
-
if len(slowest_tests) > 0:
|
|
648
|
-
top_slow = slowest_tests[0]
|
|
649
|
-
recommendations.append(
|
|
650
|
-
f"Review the slowest test: {top_slow['test_name']} "
|
|
651
|
-
f"(avg {top_slow['avg_duration']}s) for avoidable delays."
|
|
652
|
-
)
|
|
653
|
-
|
|
654
|
-
# Trend-based recommendations
|
|
655
|
-
trend = summary.get('trend', '0%')
|
|
656
|
-
if trend.startswith('-'):
|
|
657
|
-
recommendations.append(
|
|
658
|
-
f"Pass rate is declining ({trend}). "
|
|
659
|
-
"Review recent failures and changes to the test environment or product."
|
|
660
|
-
)
|
|
661
|
-
elif trend.startswith('+') and float(trend.replace('%', '').replace('+', '')) > 2:
|
|
662
|
-
recommendations.append(
|
|
663
|
-
f"Pass rate is improving ({trend}). "
|
|
664
|
-
"Continue current practices and share learnings with team."
|
|
665
|
-
)
|
|
666
|
-
|
|
667
|
-
return recommendations
|
|
@@ -57,8 +57,8 @@ button:disabled {{opacity:.55;cursor:wait}}
|
|
|
57
57
|
<p id="period-status" role="status"><small>Change either date to use a custom range.</small></p>
|
|
58
58
|
<label>Formats</label><div class="formats">
|
|
59
59
|
<label><input type="checkbox" name="format" value="pdf" checked> PDF</label>
|
|
60
|
-
<label><input type="checkbox" name="format" value="pptx"
|
|
61
|
-
<label><input type="checkbox" name="format" value="xlsx"
|
|
60
|
+
<label><input type="checkbox" name="format" value="pptx"> PowerPoint</label>
|
|
61
|
+
<label><input type="checkbox" name="format" value="xlsx"> Excel</label></div>
|
|
62
62
|
<button id="generate" type="submit" onclick="this.textContent='Generating…';">Generate and download</button></form>
|
|
63
63
|
<p><small>Runs stay in S3. The ZIP downloads when generation finishes. Watch the PowerShell window for progress; large date ranges may take a while.</small></p>
|
|
64
64
|
<script>
|
|
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name='test-reporting',
|
|
12
|
-
version='4.4.
|
|
12
|
+
version='4.4.3',
|
|
13
13
|
description='Multi-project test reporting dashboard — collect results locally or push to S3',
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: test-reporting
|
|
3
|
-
Version: 4.4.
|
|
3
|
+
Version: 4.4.3
|
|
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
|
|
@@ -260,7 +260,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
260
260
|
| `test-report suites` | Show suite statistics (reads local SQLite) |
|
|
261
261
|
| `test-report cleanup` | Delete old runs from local SQLite |
|
|
262
262
|
| `test-report cleanup-artifacts` | Delete old screenshots and traces (preserves data) |
|
|
263
|
-
| `test-report monthly-report` | Generate
|
|
263
|
+
| `test-report monthly-report` | Generate a project report (PDF default; PPTX/XLSX optional) |
|
|
264
264
|
| `test-report monthly-ui` | Open local project and date picker for reports |
|
|
265
265
|
|
|
266
266
|
### Cleaning up old data
|
|
@@ -320,39 +320,9 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
320
320
|
|
|
321
321
|
## Monthly Reports
|
|
322
322
|
|
|
323
|
-
Generate a report for one project from its published run history.
|
|
323
|
+
Generate a report for one project from its published S3 or local run history. PDF is the default stakeholder report; PowerPoint and Excel are optional exports. The local UI offers rolling date presets, all published history, and custom dates. Reports are downloaded locally and do not change the publishing pipeline.
|
|
324
324
|
|
|
325
|
-
For
|
|
326
|
-
|
|
327
|
-
### Quick Start
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# Install with report dependencies and S3 support
|
|
331
|
-
pip install test-reporting[s3,reports]
|
|
332
|
-
|
|
333
|
-
# Open the local project and date picker
|
|
334
|
-
test-report monthly-ui --config reporting.ini
|
|
335
|
-
|
|
336
|
-
# Generate without the UI (defaults to the last 30 days)
|
|
337
|
-
test-report monthly-report --project "My Project" --format pptx,xlsx,pdf
|
|
338
|
-
|
|
339
|
-
# Custom date range
|
|
340
|
-
test-report monthly-report --project "My Project" --start 2026-08-01 --end 2026-08-31 --format xlsx
|
|
341
|
-
|
|
342
|
-
# Specific project
|
|
343
|
-
test-report monthly-report --project "My Project" --format pptx
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### Features
|
|
347
|
-
|
|
348
|
-
- 📊 Executive summary with health score
|
|
349
|
-
- 📈 Pass rate trends and test volume charts
|
|
350
|
-
- 🔥 Failure hotspots and flaky test detection
|
|
351
|
-
- 🐌 Slowest tests and performance regressions
|
|
352
|
-
- 📁 File health report
|
|
353
|
-
- 💡 Actionable recommendations
|
|
354
|
-
|
|
355
|
-
**See [REPORT_GENERATOR.md](REPORT_GENERATOR.md) for setup and metric definitions.**
|
|
325
|
+
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
356
326
|
|
|
357
327
|
---
|
|
358
328
|
|
|
@@ -156,6 +156,9 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
156
156
|
self.assertIn(b'Project A', page)
|
|
157
157
|
self.assertIn(b'Last 3 months', page)
|
|
158
158
|
self.assertIn(b'All data', page)
|
|
159
|
+
self.assertIn(b'value="pdf" checked', page)
|
|
160
|
+
self.assertIn(b'value="pptx"> PowerPoint', page)
|
|
161
|
+
self.assertIn(b'value="xlsx"> Excel', page)
|
|
159
162
|
with urllib.request.urlopen(address + '/date-bounds?project=Project%20A') as response:
|
|
160
163
|
self.assertEqual(json.loads(response.read()),
|
|
161
164
|
{'start': '2026-09-30', 'end': '2026-10-01'})
|
|
@@ -189,14 +192,47 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
189
192
|
from openpyxl import load_workbook
|
|
190
193
|
from pptx import Presentation
|
|
191
194
|
workbook = load_workbook(next(p for p in files if p.suffix == '.xlsx'))
|
|
195
|
+
self.assertNotIn('Recommendations', workbook.sheetnames)
|
|
192
196
|
self.assertEqual(workbook['Summary']['A24'].value, 'KEY FINDINGS')
|
|
193
197
|
self.assertIn('100.0% pass rate', workbook['Summary']['A25'].value)
|
|
194
198
|
self.assertEqual(workbook['Pass Rate Trend'].freeze_panes, 'B2')
|
|
195
199
|
deck = Presentation(next(p for p in files if p.suffix == '.pptx'))
|
|
200
|
+
self.assertNotIn('Recommendations',
|
|
201
|
+
[slide.shapes.title.text for slide in deck.slides if slide.shapes.title])
|
|
196
202
|
summary_text = ' '.join(shape.text for shape in deck.slides[1].shapes if shape.has_text_frame)
|
|
197
203
|
self.assertIn('KEY FINDINGS', summary_text)
|
|
198
204
|
self.assertIn('100.0% pass rate', summary_text)
|
|
199
205
|
|
|
206
|
+
@unittest.skipUnless(importlib.util.find_spec('reportlab'), 'Install test-reporting[reports]')
|
|
207
|
+
def test_default_report_format_is_pdf(self):
|
|
208
|
+
files = MonthlyReportGenerator(self.config).generate(
|
|
209
|
+
'2026-10-01', '2026-10-01', project='Project A',
|
|
210
|
+
output_dir=self.config.STORE_PATH / 'exports')
|
|
211
|
+
self.assertEqual([path.suffix for path in files], ['.pdf'])
|
|
212
|
+
|
|
213
|
+
@unittest.skipUnless(importlib.util.find_spec('reportlab'), 'Install test-reporting[reports]')
|
|
214
|
+
def test_executive_summary_is_short_pdf_with_period_measures(self):
|
|
215
|
+
files = MonthlyReportGenerator(self.config).generate(
|
|
216
|
+
'2026-10-01', '2026-10-01', project='Project A',
|
|
217
|
+
report_type='executive', output_dir=self.config.STORE_PATH / 'exports')
|
|
218
|
+
self.assertEqual(len(files), 1)
|
|
219
|
+
self.assertIn('executive-summary_', files[0].name)
|
|
220
|
+
self.assertGreater(files[0].stat().st_size, 1000)
|
|
221
|
+
if importlib.util.find_spec('pypdf'):
|
|
222
|
+
from pypdf import PdfReader
|
|
223
|
+
pages = PdfReader(str(files[0])).pages
|
|
224
|
+
self.assertLessEqual(len(pages), 2)
|
|
225
|
+
text = ' '.join(page.extract_text() for page in pages)
|
|
226
|
+
self.assertIn('Executive Summary', text)
|
|
227
|
+
self.assertIn('Previous period', text)
|
|
228
|
+
self.assertNotIn('Test files and test cases', text)
|
|
229
|
+
|
|
230
|
+
def test_executive_summary_rejects_other_formats(self):
|
|
231
|
+
with self.assertRaisesRegex(ValueError, 'PDF only'):
|
|
232
|
+
MonthlyReportGenerator(self.config).generate(
|
|
233
|
+
'2026-10-01', '2026-10-01', project='Project A',
|
|
234
|
+
report_type='executive', formats=['pdf', 'xlsx'])
|
|
235
|
+
|
|
200
236
|
|
|
201
237
|
if __name__ == '__main__':
|
|
202
238
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|