test-reporting 4.4.2__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.2 → test_reporting-4.4.3}/PKG-INFO +1 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/__init__.py +1 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/cli.py +4 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/exporters/pdf_exporter.py +89 -15
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/monthly_report.py +10 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/setup.py +1 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/PKG-INFO +1 -1
- {test_reporting-4.4.2 → test_reporting-4.4.3}/tests/test_published_monthly_report.py +23 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/LICENSE +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/README.md +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/classifier.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/config.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/exporters/__init__.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/exporters/pptx_exporter.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/exporters/xlsx_exporter.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/monthly_ui.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/pdf_analysis.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/plugin.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/publisher.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/report_insights.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/run_source.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/storage.py +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/templates/index.html +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/templates/project.html +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/reporting/templates/run.html +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/setup.cfg +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/SOURCES.txt +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/dependency_links.txt +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/entry_points.txt +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/requires.txt +0 -0
- {test_reporting-4.4.2 → test_reporting-4.4.3}/test_reporting.egg-info/top_level.txt +0 -0
|
@@ -366,6 +366,8 @@ def monthly_report():
|
|
|
366
366
|
help='Output format(s): pdf, pptx, xlsx (comma-separated; default: pdf)')
|
|
367
367
|
parser.add_argument('--output', help='Output directory (default: ./reports)')
|
|
368
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)')
|
|
369
371
|
parser.add_argument('--config', default='reporting.ini', help='Config file path')
|
|
370
372
|
|
|
371
373
|
args = parser.parse_args(sys.argv[2:])
|
|
@@ -407,7 +409,8 @@ def monthly_report():
|
|
|
407
409
|
project=args.project,
|
|
408
410
|
formats=formats,
|
|
409
411
|
top_n=args.top_n,
|
|
410
|
-
output_dir=output_dir
|
|
412
|
+
output_dir=output_dir,
|
|
413
|
+
report_type=args.report_type
|
|
411
414
|
)
|
|
412
415
|
|
|
413
416
|
print(f"\n[Monthly Report] Generated {len(files)} file(s):")
|
|
@@ -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'),
|
|
@@ -27,7 +27,8 @@ class MonthlyReportGenerator:
|
|
|
27
27
|
formats: List[str] = None,
|
|
28
28
|
sections: Dict[str, bool] = None,
|
|
29
29
|
top_n: int = 10,
|
|
30
|
-
output_dir: Optional[Path] = None
|
|
30
|
+
output_dir: Optional[Path] = None,
|
|
31
|
+
report_type: str = 'detailed'
|
|
31
32
|
) -> List[Path]:
|
|
32
33
|
"""
|
|
33
34
|
Generate monthly report in specified formats.
|
|
@@ -40,6 +41,7 @@ class MonthlyReportGenerator:
|
|
|
40
41
|
sections: Dict of section names to include/exclude
|
|
41
42
|
top_n: Number of items to show in top N lists
|
|
42
43
|
output_dir: Output directory (defaults to temp)
|
|
44
|
+
report_type: 'detailed' or 'executive' (PDF only)
|
|
43
45
|
|
|
44
46
|
Returns:
|
|
45
47
|
List of generated file paths
|
|
@@ -53,6 +55,10 @@ class MonthlyReportGenerator:
|
|
|
53
55
|
formats = formats or ['pdf']
|
|
54
56
|
if not set(formats) <= {'pptx', 'xlsx', 'pdf'}:
|
|
55
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')
|
|
56
62
|
sections = sections or {}
|
|
57
63
|
output_dir = output_dir or Path.cwd() / 'reports'
|
|
58
64
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -92,6 +98,7 @@ class MonthlyReportGenerator:
|
|
|
92
98
|
'project': project or 'All Projects',
|
|
93
99
|
'generated_at': datetime.now().isoformat(),
|
|
94
100
|
'top_n': top_n,
|
|
101
|
+
'report_type': report_type,
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
# Generate each format
|
|
@@ -120,6 +127,8 @@ class MonthlyReportGenerator:
|
|
|
120
127
|
from .pdf_analysis import build_pdf_analysis
|
|
121
128
|
exporter = PDFExporter()
|
|
122
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)
|
|
123
132
|
output_path = output_dir / filename
|
|
124
133
|
metrics['pdf_analysis'] = build_pdf_analysis(data)
|
|
125
134
|
exporter.export(metrics, sections, report_meta, output_path)
|
|
@@ -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",
|
|
@@ -210,6 +210,29 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
210
210
|
output_dir=self.config.STORE_PATH / 'exports')
|
|
211
211
|
self.assertEqual([path.suffix for path in files], ['.pdf'])
|
|
212
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
|
+
|
|
213
236
|
|
|
214
237
|
if __name__ == '__main__':
|
|
215
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|