test-reporting 4.4.3__tar.gz → 4.4.4__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.3 → test_reporting-4.4.4}/PKG-INFO +4 -1
- {test_reporting-4.4.3 → test_reporting-4.4.4}/README.md +3 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/__init__.py +1 -1
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/cli.py +19 -0
- test_reporting-4.4.4/reporting/coverage.py +115 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/exporters/pdf_exporter.py +37 -3
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/exporters/pptx_exporter.py +41 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/exporters/xlsx_exporter.py +31 -2
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/monthly_report.py +2 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/templates/index.html +22 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/templates/project.html +48 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/setup.py +1 -1
- {test_reporting-4.4.3 → test_reporting-4.4.4}/test_reporting.egg-info/PKG-INFO +4 -1
- {test_reporting-4.4.3 → test_reporting-4.4.4}/test_reporting.egg-info/SOURCES.txt +1 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/tests/test_published_monthly_report.py +91 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/LICENSE +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/classifier.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/config.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/exporters/__init__.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/monthly_ui.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/pdf_analysis.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/plugin.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/publisher.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/report_insights.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/run_source.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/storage.py +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/reporting/templates/run.html +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/setup.cfg +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/test_reporting.egg-info/dependency_links.txt +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/test_reporting.egg-info/entry_points.txt +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/test_reporting.egg-info/requires.txt +0 -0
- {test_reporting-4.4.3 → test_reporting-4.4.4}/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.4
|
|
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
|
|
@@ -254,6 +254,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
254
254
|
| Command | Description |
|
|
255
255
|
|---|---|
|
|
256
256
|
| `test-report publish` | Push latest test run to the store |
|
|
257
|
+
| `test-report publish-coverage` | Publish project-owned automation inventory counts |
|
|
257
258
|
| `test-report deploy` | Deploy static dashboard HTML to the store (run once) |
|
|
258
259
|
| `test-report open` | Open local dashboard in browser |
|
|
259
260
|
| `test-report stats` | Show stats from latest run (reads local SQLite) |
|
|
@@ -322,6 +323,8 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
322
323
|
|
|
323
324
|
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
325
|
|
|
326
|
+
Projects can also publish QA-maintained automation inventory counts with `test-report publish-coverage --config reporting-jenkins.ini --file coverage.json`. The dashboard and monthly reports show the resulting automation coverage separately from test pass rates. See [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md#project-supplied-automation-coverage) for the file format and publishing steps.
|
|
327
|
+
|
|
325
328
|
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
326
329
|
|
|
327
330
|
---
|
|
@@ -213,6 +213,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
213
213
|
| Command | Description |
|
|
214
214
|
|---|---|
|
|
215
215
|
| `test-report publish` | Push latest test run to the store |
|
|
216
|
+
| `test-report publish-coverage` | Publish project-owned automation inventory counts |
|
|
216
217
|
| `test-report deploy` | Deploy static dashboard HTML to the store (run once) |
|
|
217
218
|
| `test-report open` | Open local dashboard in browser |
|
|
218
219
|
| `test-report stats` | Show stats from latest run (reads local SQLite) |
|
|
@@ -281,6 +282,8 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
281
282
|
|
|
282
283
|
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
284
|
|
|
285
|
+
Projects can also publish QA-maintained automation inventory counts with `test-report publish-coverage --config reporting-jenkins.ini --file coverage.json`. The dashboard and monthly reports show the resulting automation coverage separately from test pass rates. See [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md#project-supplied-automation-coverage) for the file format and publishing steps.
|
|
286
|
+
|
|
284
287
|
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
285
288
|
|
|
286
289
|
---
|
|
@@ -90,6 +90,24 @@ def deploy(config_file='reporting.ini'):
|
|
|
90
90
|
print(f" test-report open")
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
def publish_coverage():
|
|
94
|
+
"""Publish project-owned coverage counts independently of test runs."""
|
|
95
|
+
import argparse
|
|
96
|
+
from .coverage import CoverageStore
|
|
97
|
+
|
|
98
|
+
parser = argparse.ArgumentParser(description='Publish project automation coverage')
|
|
99
|
+
parser.add_argument('--config', default='reporting.ini', help='Project reporting config')
|
|
100
|
+
parser.add_argument('--file', required=True, help='Coverage JSON maintained by the project')
|
|
101
|
+
args = parser.parse_args(sys.argv[2:])
|
|
102
|
+
config = ReportingConfig(config_file=args.config)
|
|
103
|
+
if config.STORE_TYPE == 's3' and not config.S3_BUCKET:
|
|
104
|
+
parser.error('S3 coverage publishing requires s3_bucket in the config')
|
|
105
|
+
snapshot = CoverageStore(config).publish(args.file)
|
|
106
|
+
print(f"[Reporting] Automation coverage published for {snapshot['project_name']}: "
|
|
107
|
+
f"{snapshot['automated_items']}/{snapshot['total_items']} "
|
|
108
|
+
f"({snapshot['coverage_percent']}%) as of {snapshot['as_of']}")
|
|
109
|
+
|
|
110
|
+
|
|
93
111
|
def open_dashboard():
|
|
94
112
|
"""Serve the local dashboard over HTTP and open it in a browser.
|
|
95
113
|
|
|
@@ -436,6 +454,7 @@ def main():
|
|
|
436
454
|
"""Main CLI entry point."""
|
|
437
455
|
commands = {
|
|
438
456
|
'publish': (publish, 'Push latest test run to the configured store'),
|
|
457
|
+
'publish-coverage': (publish_coverage, 'Publish project automation coverage counts'),
|
|
439
458
|
'deploy': (deploy, 'Deploy static dashboard HTML to the store (run once)'),
|
|
440
459
|
'rebuild': (rebuild_dashboard, 'Rebuild data.json from existing run files'),
|
|
441
460
|
'open': (open_dashboard, 'Open local dashboard in browser'),
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""Project-supplied automation coverage snapshots, separate from test runs."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from datetime import date
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def validate_coverage(payload, project_name=None):
|
|
9
|
+
"""Normalize counts so every presentation uses the same denominator."""
|
|
10
|
+
if not isinstance(payload, dict):
|
|
11
|
+
raise ValueError('Coverage input must be a JSON object')
|
|
12
|
+
project = project_name or payload.get('project_name')
|
|
13
|
+
if not isinstance(project, str) or not project.strip() or '/' in project or '\\' in project:
|
|
14
|
+
raise ValueError('Coverage requires a valid project name')
|
|
15
|
+
if payload.get('project_name') and payload['project_name'] != project:
|
|
16
|
+
raise ValueError('Coverage project_name must match reporting.ini')
|
|
17
|
+
try:
|
|
18
|
+
as_of = date.fromisoformat(payload['as_of']).isoformat()
|
|
19
|
+
except (KeyError, TypeError, ValueError) as exc:
|
|
20
|
+
raise ValueError('Coverage as_of must be a YYYY-MM-DD date') from exc
|
|
21
|
+
total = payload.get('total_items')
|
|
22
|
+
automated = payload.get('automated_items')
|
|
23
|
+
if (type(total) is not int or total < 1 or
|
|
24
|
+
type(automated) is not int or not 0 <= automated <= total):
|
|
25
|
+
raise ValueError('Coverage requires total_items > 0 and 0 <= automated_items <= total_items')
|
|
26
|
+
return {
|
|
27
|
+
'schema_version': 1,
|
|
28
|
+
'project_name': project,
|
|
29
|
+
'as_of': as_of,
|
|
30
|
+
'total_items': total,
|
|
31
|
+
'automated_items': automated,
|
|
32
|
+
'not_automated_items': total - automated,
|
|
33
|
+
'coverage_percent': round(automated / total * 100, 1),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CoverageStore:
|
|
38
|
+
def __init__(self, config, s3_client=None):
|
|
39
|
+
self.config = config
|
|
40
|
+
self._s3_client = s3_client
|
|
41
|
+
|
|
42
|
+
def _client(self):
|
|
43
|
+
if self._s3_client is None:
|
|
44
|
+
try:
|
|
45
|
+
import boto3
|
|
46
|
+
except ImportError as exc:
|
|
47
|
+
raise RuntimeError('Install test-reporting[s3] for S3 coverage') from exc
|
|
48
|
+
self._s3_client = boto3.client('s3', region_name=self.config.S3_REGION)
|
|
49
|
+
return self._s3_client
|
|
50
|
+
|
|
51
|
+
def _key(self, project, filename):
|
|
52
|
+
return '/'.join(part.strip('/') for part in
|
|
53
|
+
(self.config.S3_PREFIX, 'coverage', project, filename) if part)
|
|
54
|
+
|
|
55
|
+
def _read(self, project, filename):
|
|
56
|
+
if self.config.STORE_TYPE == 's3':
|
|
57
|
+
try:
|
|
58
|
+
body = self._client().get_object(
|
|
59
|
+
Bucket=self.config.S3_BUCKET, Key=self._key(project, filename))['Body'].read()
|
|
60
|
+
except Exception as exc:
|
|
61
|
+
code = getattr(exc, 'response', {}).get('Error', {}).get('Code')
|
|
62
|
+
if code in {'NoSuchKey', '404', 'NotFound'}:
|
|
63
|
+
return None
|
|
64
|
+
raise
|
|
65
|
+
return validate_coverage(json.loads(body), project)
|
|
66
|
+
path = self.config.STORE_PATH / 'coverage' / project / filename
|
|
67
|
+
return validate_coverage(json.loads(path.read_text(encoding='utf-8')), project) if path.exists() else None
|
|
68
|
+
|
|
69
|
+
def _write(self, snapshot, filename):
|
|
70
|
+
project = snapshot['project_name']
|
|
71
|
+
body = json.dumps(snapshot, indent=2).encode('utf-8')
|
|
72
|
+
if self.config.STORE_TYPE == 's3':
|
|
73
|
+
self._client().put_object(
|
|
74
|
+
Bucket=self.config.S3_BUCKET, Key=self._key(project, filename),
|
|
75
|
+
Body=body, ContentType='application/json', CacheControl='no-cache')
|
|
76
|
+
else:
|
|
77
|
+
path = self.config.STORE_PATH / 'coverage' / project / filename
|
|
78
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
79
|
+
path.write_bytes(body)
|
|
80
|
+
|
|
81
|
+
def publish(self, input_file):
|
|
82
|
+
"""Store a dated snapshot and update the dashboard pointer if it is newest."""
|
|
83
|
+
payload = json.loads(Path(input_file).read_text(encoding='utf-8'))
|
|
84
|
+
snapshot = validate_coverage(payload, self.config.PROJECT_NAME)
|
|
85
|
+
project = snapshot['project_name']
|
|
86
|
+
self._write(snapshot, snapshot['as_of'] + '.json')
|
|
87
|
+
latest = self._read(project, 'latest.json')
|
|
88
|
+
if latest is None or snapshot['as_of'] >= latest['as_of']:
|
|
89
|
+
self._write(snapshot, 'latest.json')
|
|
90
|
+
return snapshot
|
|
91
|
+
|
|
92
|
+
def as_of(self, project, end_date):
|
|
93
|
+
"""Latest project snapshot on or before the report end date."""
|
|
94
|
+
cutoff = date.fromisoformat(end_date)
|
|
95
|
+
if self.config.STORE_TYPE == 's3':
|
|
96
|
+
prefix = self._key(project, '') + '/'
|
|
97
|
+
pages = self._client().get_paginator('list_objects_v2').paginate(
|
|
98
|
+
Bucket=self.config.S3_BUCKET, Prefix=prefix)
|
|
99
|
+
names = (item['Key'][len(prefix):] for page in pages for item in page.get('Contents', []))
|
|
100
|
+
else:
|
|
101
|
+
folder = self.config.STORE_PATH / 'coverage' / project
|
|
102
|
+
names = (path.name for path in folder.glob('*.json')) if folder.exists() else ()
|
|
103
|
+
dates = []
|
|
104
|
+
for name in names:
|
|
105
|
+
if '/' in name or not name.endswith('.json') or name == 'latest.json':
|
|
106
|
+
continue
|
|
107
|
+
try:
|
|
108
|
+
day = date.fromisoformat(name[:-5])
|
|
109
|
+
except ValueError:
|
|
110
|
+
continue
|
|
111
|
+
if day <= cutoff:
|
|
112
|
+
dates.append(day)
|
|
113
|
+
if not dates:
|
|
114
|
+
return None
|
|
115
|
+
return self._read(project, max(dates).isoformat() + '.json')
|
|
@@ -5,7 +5,7 @@ from typing import Any, Dict
|
|
|
5
5
|
from xml.sax.saxutils import escape
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
|
-
from reportlab.graphics.shapes import Circle, Drawing, Line, Rect, String
|
|
8
|
+
from reportlab.graphics.shapes import Circle, Drawing, Line, Rect, String, Wedge
|
|
9
9
|
from reportlab.lib import colors
|
|
10
10
|
from reportlab.lib.enums import TA_CENTER, TA_LEFT
|
|
11
11
|
from reportlab.lib.pagesizes import A4
|
|
@@ -181,6 +181,7 @@ class PDFExporter:
|
|
|
181
181
|
self._p('Passed, failed and skipped shares of all recorded executions.', 'Small'),
|
|
182
182
|
Spacer(1, 4), self._outcome_chart(analysis),
|
|
183
183
|
])
|
|
184
|
+
story.extend(self._coverage_section(metrics.get('coverage')))
|
|
184
185
|
daily = metrics.get('daily_trends', [])[-12:]
|
|
185
186
|
if len(daily) > 1:
|
|
186
187
|
story.extend([
|
|
@@ -196,7 +197,38 @@ class PDFExporter:
|
|
|
196
197
|
'Some run files lack full test-level detail. Test-specific observations are omitted.', 'Small')])
|
|
197
198
|
story.extend([Spacer(1, 5), self._p(
|
|
198
199
|
'Source: published automated test runs for this project and period. '
|
|
199
|
-
'
|
|
200
|
+
'Coverage, when supplied, comes from a separate project-maintained inventory.', 'Small')])
|
|
201
|
+
return story
|
|
202
|
+
|
|
203
|
+
def _coverage_section(self, coverage):
|
|
204
|
+
story = [Spacer(1, 10), self._p('Automation coverage', 'SubTitle')]
|
|
205
|
+
if coverage is None:
|
|
206
|
+
story.append(self._p('No project-supplied coverage snapshot is available on or before the report end date.',
|
|
207
|
+
'Small'))
|
|
208
|
+
return story
|
|
209
|
+
rate = coverage['coverage_percent']
|
|
210
|
+
chart = Drawing(495, 138)
|
|
211
|
+
chart.add(Circle(70, 69, 57, fillColor=self.border, strokeColor=None))
|
|
212
|
+
if rate >= 100:
|
|
213
|
+
chart.add(Circle(70, 69, 57, fillColor=self.teal, strokeColor=None))
|
|
214
|
+
elif rate > 0:
|
|
215
|
+
chart.add(Wedge(70, 69, 57, 90, 90 + 360 * rate / 100,
|
|
216
|
+
fillColor=self.teal, strokeColor=None))
|
|
217
|
+
chart.add(Circle(70, 69, 41, fillColor=colors.white, strokeColor=None))
|
|
218
|
+
chart.add(String(70, 70, f'{rate:.1f}%', fontName='Helvetica-Bold', fontSize=18,
|
|
219
|
+
fillColor=self.navy, textAnchor='middle'))
|
|
220
|
+
chart.add(String(70, 53, 'automated', fontName='Helvetica', fontSize=8,
|
|
221
|
+
fillColor=self.muted, textAnchor='middle'))
|
|
222
|
+
chart.add(String(160, 100, f"{coverage['automated_items']:,} automated items",
|
|
223
|
+
fontName='Helvetica-Bold', fontSize=12, fillColor=self.navy))
|
|
224
|
+
chart.add(String(160, 77, f"{coverage['not_automated_items']:,} not automated items",
|
|
225
|
+
fontName='Helvetica', fontSize=10, fillColor=self.ink))
|
|
226
|
+
chart.add(String(160, 54, f"{coverage['total_items']:,} total tracked items",
|
|
227
|
+
fontName='Helvetica', fontSize=10, fillColor=self.ink))
|
|
228
|
+
chart.add(String(160, 28, f"Project inventory as of {coverage['as_of']}",
|
|
229
|
+
fontName='Helvetica', fontSize=9, fillColor=self.muted))
|
|
230
|
+
story.extend([self._p('Automated items / total tracked items. Supplied by the project; '
|
|
231
|
+
'separate from execution pass rate.', 'Small'), Spacer(1, 5), chart])
|
|
200
232
|
return story
|
|
201
233
|
|
|
202
234
|
def _cover(self, meta, summary, analysis):
|
|
@@ -224,7 +256,8 @@ class PDFExporter:
|
|
|
224
256
|
self._p('What this report measures', 'SubTitle'),
|
|
225
257
|
self._p('Results from published automated test runs for one project and the selected period. '
|
|
226
258
|
'Pass rate is passed executions divided by all executions, including skipped tests. '
|
|
227
|
-
'
|
|
259
|
+
'Execution measures describe observed tests. Automation coverage, when supplied, '
|
|
260
|
+
'comes from a separate project inventory.'),
|
|
228
261
|
Spacer(1, 12),
|
|
229
262
|
self._p('Generated from run history; individual test measures appear only when detailed '
|
|
230
263
|
'records cover all passed and failed executions.', 'Small')])
|
|
@@ -259,6 +292,7 @@ class PDFExporter:
|
|
|
259
292
|
story.extend([Spacer(1, 16), self._p('Execution outcome mix', 'SubTitle'),
|
|
260
293
|
self._p('Share of all test executions by outcome. The denominator includes skipped tests.', 'Small'),
|
|
261
294
|
Spacer(1, 6), self._outcome_chart(analysis)])
|
|
295
|
+
story.extend(self._coverage_section(metrics.get('coverage')))
|
|
262
296
|
if not summary.get('detail_complete'):
|
|
263
297
|
story.extend([Spacer(1, 12), self._p('Data completeness', 'SubTitle'),
|
|
264
298
|
self._p('Some published runs do not contain full test-level detail. File and test case '
|
|
@@ -53,6 +53,8 @@ class PowerPointExporter:
|
|
|
53
53
|
# Slide 2: Executive Summary
|
|
54
54
|
if sections.get('summary', True):
|
|
55
55
|
self._add_summary_slide(prs, metrics['summary'], metrics.get('highlights', []))
|
|
56
|
+
if metrics.get('coverage'):
|
|
57
|
+
self._add_coverage_slide(prs, metrics['coverage'])
|
|
56
58
|
|
|
57
59
|
# Slide 3: Pass Rate Trend
|
|
58
60
|
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
@@ -204,6 +206,45 @@ class PowerPointExporter:
|
|
|
204
206
|
note.text_frame.paragraphs[0].font.size = Pt(9)
|
|
205
207
|
note.text_frame.paragraphs[0].font.color.rgb = self.colors['gray']
|
|
206
208
|
|
|
209
|
+
def _add_coverage_slide(self, prs, coverage):
|
|
210
|
+
slide = prs.slides.add_slide(prs.slide_layouts[5])
|
|
211
|
+
slide.shapes.title.text = 'Automation Coverage'
|
|
212
|
+
data = CategoryChartData()
|
|
213
|
+
data.categories = ['Automated', 'Not automated']
|
|
214
|
+
data.add_series('Tracked items',
|
|
215
|
+
(coverage['automated_items'], coverage['not_automated_items']))
|
|
216
|
+
chart = slide.shapes.add_chart(
|
|
217
|
+
XL_CHART_TYPE.DOUGHNUT, Inches(0.8), Inches(1.4),
|
|
218
|
+
Inches(4.3), Inches(4.4), data).chart
|
|
219
|
+
chart.has_legend = True
|
|
220
|
+
chart.legend.include_in_layout = False
|
|
221
|
+
chart.plots[0].hole_size = 72
|
|
222
|
+
for point, color in zip(chart.series[0].points,
|
|
223
|
+
(self.teal, RGBColor(220, 229, 237))):
|
|
224
|
+
point.format.fill.solid()
|
|
225
|
+
point.format.fill.fore_color.rgb = color
|
|
226
|
+
details = slide.shapes.add_textbox(Inches(5.4), Inches(1.85),
|
|
227
|
+
Inches(3.9), Inches(3.8)).text_frame
|
|
228
|
+
details.text = f"{coverage['coverage_percent']:.1f}% automated"
|
|
229
|
+
details.paragraphs[0].font.size = Pt(30)
|
|
230
|
+
details.paragraphs[0].font.bold = True
|
|
231
|
+
details.paragraphs[0].font.color.rgb = self.teal
|
|
232
|
+
for text in (
|
|
233
|
+
f"{coverage['automated_items']:,} automated items",
|
|
234
|
+
f"{coverage['not_automated_items']:,} not automated items",
|
|
235
|
+
f"{coverage['total_items']:,} total tracked items",
|
|
236
|
+
f"Project inventory as of {coverage['as_of']}"):
|
|
237
|
+
paragraph = details.add_paragraph()
|
|
238
|
+
paragraph.text = text
|
|
239
|
+
paragraph.font.size = Pt(17)
|
|
240
|
+
paragraph.font.color.rgb = self.ink
|
|
241
|
+
paragraph.space_before = Pt(14)
|
|
242
|
+
note = slide.shapes.add_textbox(Inches(0.8), Inches(6.35),
|
|
243
|
+
Inches(8.7), Inches(0.35))
|
|
244
|
+
note.text_frame.text = 'Project-supplied inventory; separate from test execution pass rate.'
|
|
245
|
+
note.text_frame.paragraphs[0].font.size = Pt(11)
|
|
246
|
+
note.text_frame.paragraphs[0].font.color.rgb = self.colors['gray']
|
|
247
|
+
|
|
207
248
|
def _polish_deck(self, prs, report_meta):
|
|
208
249
|
"""Apply one restrained visual system to every slide."""
|
|
209
250
|
for number, slide in enumerate(prs.slides, 1):
|
|
@@ -6,7 +6,7 @@ from typing import Dict, Any, List
|
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
from openpyxl import Workbook
|
|
9
|
-
from openpyxl.chart import LineChart, PieChart, BarChart, Reference
|
|
9
|
+
from openpyxl.chart import LineChart, PieChart, BarChart, DoughnutChart, Reference
|
|
10
10
|
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
|
|
11
11
|
from openpyxl.utils import get_column_letter
|
|
12
12
|
except ImportError:
|
|
@@ -46,6 +46,8 @@ class ExcelExporter:
|
|
|
46
46
|
# Sheet 1: Summary
|
|
47
47
|
if sections.get('summary', True):
|
|
48
48
|
self._create_summary_sheet(wb, metrics['summary'], report_meta)
|
|
49
|
+
if metrics.get('coverage'):
|
|
50
|
+
self._create_coverage_sheet(wb, metrics['coverage'])
|
|
49
51
|
|
|
50
52
|
# Sheet 2: Daily Trends
|
|
51
53
|
if sections.get('trends', True) and metrics.get('daily_trends'):
|
|
@@ -128,7 +130,7 @@ class ExcelExporter:
|
|
|
128
130
|
ws['A7'].font = Font(name='Aptos', size=12, bold=True, color='FFFFFF')
|
|
129
131
|
ws['A7'].alignment = Alignment(vertical='center', indent=1)
|
|
130
132
|
ws.row_dimensions[7].height = 26
|
|
131
|
-
for row in range(8,
|
|
133
|
+
for row in range(8, 23):
|
|
132
134
|
ws.row_dimensions[row].height = 23
|
|
133
135
|
ws[f'A{row}'].font = Font(name='Aptos', size=10, color='64748B', bold=True)
|
|
134
136
|
ws[f'B{row}'].font = Font(name='Aptos', size=11, color=ink, bold=True)
|
|
@@ -153,8 +155,35 @@ class ExcelExporter:
|
|
|
153
155
|
ws.merge_cells(start_row=note_row, start_column=1, end_row=note_row, end_column=4)
|
|
154
156
|
note = ws.cell(note_row, 1, 'Execution health reflects test outcomes, not coverage or defect severity.')
|
|
155
157
|
note.font = Font(name='Aptos', size=9, italic=True, color='64748B')
|
|
158
|
+
coverage = metrics.get('coverage')
|
|
159
|
+
if coverage:
|
|
160
|
+
ws['A22'] = 'Automation Coverage'
|
|
161
|
+
ws['B22'] = f"{coverage['coverage_percent']}%"
|
|
162
|
+
ws['C22'] = f"{coverage['automated_items']} of {coverage['total_items']} items"
|
|
163
|
+
ws['D22'] = f"As of {coverage['as_of']}"
|
|
164
|
+
ws['B22'].font = Font(name='Aptos', size=11, color=teal, bold=True)
|
|
156
165
|
ws.freeze_panes = 'A8'
|
|
157
166
|
ws.print_area = f'A1:D{note_row}'
|
|
167
|
+
|
|
168
|
+
def _create_coverage_sheet(self, wb, coverage):
|
|
169
|
+
ws = wb.create_sheet('Automation Coverage')
|
|
170
|
+
ws['A1'] = 'AUTOMATION COVERAGE'
|
|
171
|
+
ws['A2'] = f"Project inventory as of {coverage['as_of']}"
|
|
172
|
+
ws['A3'] = 'Automated items / total tracked items'
|
|
173
|
+
ws['B3'] = coverage['coverage_percent'] / 100
|
|
174
|
+
ws['B3'].number_format = '0.0%'
|
|
175
|
+
ws['A5'], ws['B5'] = 'Automated', coverage['automated_items']
|
|
176
|
+
ws['A6'], ws['B6'] = 'Not automated', coverage['not_automated_items']
|
|
177
|
+
ws['A7'], ws['B7'] = 'Total tracked', coverage['total_items']
|
|
178
|
+
ws['A9'] = 'Project-supplied inventory; separate from test execution pass rate.'
|
|
179
|
+
ws.column_dimensions['A'].width = 54
|
|
180
|
+
ws.column_dimensions['B'].width = 18
|
|
181
|
+
chart = DoughnutChart()
|
|
182
|
+
chart.title = 'Items with automation'
|
|
183
|
+
chart.holeSize = 72
|
|
184
|
+
chart.add_data(Reference(ws, min_col=2, min_row=5, max_row=6), titles_from_data=False)
|
|
185
|
+
chart.set_categories(Reference(ws, min_col=1, min_row=5, max_row=6))
|
|
186
|
+
ws.add_chart(chart, 'D4')
|
|
158
187
|
|
|
159
188
|
def _create_summary_sheet(self, wb, summary, report_meta):
|
|
160
189
|
"""Create summary sheet with key metrics."""
|
|
@@ -10,6 +10,7 @@ from collections import defaultdict
|
|
|
10
10
|
from .config import ReportingConfig
|
|
11
11
|
from .run_source import PublishedRunSource
|
|
12
12
|
from .report_insights import build_highlights
|
|
13
|
+
from .coverage import CoverageStore
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class MonthlyReportGenerator:
|
|
@@ -90,6 +91,7 @@ class MonthlyReportGenerator:
|
|
|
90
91
|
summary['pass_rate_change'] = (round(summary['pass_rate'] - summary['previous_pass_rate'], 1)
|
|
91
92
|
if summary['previous_pass_rate'] is not None else None)
|
|
92
93
|
metrics['highlights'] = build_highlights(metrics)
|
|
94
|
+
metrics['coverage'] = CoverageStore(self.config).as_of(project, end_date)
|
|
93
95
|
|
|
94
96
|
# Generate report metadata
|
|
95
97
|
report_meta = {
|
|
@@ -176,6 +176,9 @@
|
|
|
176
176
|
.stat-val { font-size: 18px; font-weight: 700; }
|
|
177
177
|
.stat-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase;
|
|
178
178
|
letter-spacing: .04em; margin-top: 2px; }
|
|
179
|
+
.card-coverage { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
|
|
180
|
+
color: var(--muted); font-size: 12px; }
|
|
181
|
+
.card-coverage strong { color: var(--blue); font-size: 14px; }
|
|
179
182
|
|
|
180
183
|
/* ── Custom tooltip ── */
|
|
181
184
|
[data-tooltip] { position: relative; }
|
|
@@ -472,6 +475,7 @@
|
|
|
472
475
|
'<div class="stat-lbl">Test Files</div>' +
|
|
473
476
|
'</div>' +
|
|
474
477
|
'</div>' +
|
|
478
|
+
'<div class="card-coverage" id="coverage-card-' + i + '">Automation coverage not supplied</div>' +
|
|
475
479
|
'</a>';
|
|
476
480
|
}).join('');
|
|
477
481
|
|
|
@@ -489,6 +493,24 @@
|
|
|
489
493
|
drawSparkline(i, trend);
|
|
490
494
|
});
|
|
491
495
|
});
|
|
496
|
+
|
|
497
|
+
sorted.forEach(function(proj, i) {
|
|
498
|
+
fetch('coverage/' + encodeURIComponent(proj.name) + '/latest.json', { cache: 'no-store' })
|
|
499
|
+
.then(function(r) { if (!r.ok) throw new Error(r.status); return r.json(); })
|
|
500
|
+
.then(function(coverage) {
|
|
501
|
+
const total = coverage.total_items;
|
|
502
|
+
const automated = coverage.automated_items;
|
|
503
|
+
if (coverage.project_name !== proj.name || !Number.isInteger(total) || total < 1 ||
|
|
504
|
+
!Number.isInteger(automated) || automated < 0 || automated > total) return;
|
|
505
|
+
const el = document.getElementById('coverage-card-' + i);
|
|
506
|
+
if (!el) return;
|
|
507
|
+
el.innerHTML = 'Automation coverage <strong></strong> · <span></span> items';
|
|
508
|
+
el.querySelector('strong').textContent = (automated / total * 100).toFixed(1) + '%';
|
|
509
|
+
el.querySelector('span').textContent = automated.toLocaleString() + ' / ' + total.toLocaleString();
|
|
510
|
+
el.title = 'Project inventory as of ' + coverage.as_of;
|
|
511
|
+
})
|
|
512
|
+
.catch(function() { /* Coverage is optional for each project. */ });
|
|
513
|
+
});
|
|
492
514
|
}
|
|
493
515
|
|
|
494
516
|
fetch('data.json')
|
|
@@ -138,6 +138,20 @@
|
|
|
138
138
|
.section-head h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
|
|
139
139
|
.section-explain { font-size: 13px; color: var(--muted); line-height: 1.5; }
|
|
140
140
|
.section-body { padding: 20px 24px; }
|
|
141
|
+
.coverage-layout { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
|
|
142
|
+
.coverage-ring { width: 148px; height: 148px; border-radius: 50%; flex: 0 0 148px;
|
|
143
|
+
display: grid; place-items: center; position: relative;
|
|
144
|
+
background: conic-gradient(var(--blue) 0deg var(--coverage-angle),
|
|
145
|
+
var(--border) var(--coverage-angle) 360deg); }
|
|
146
|
+
.coverage-ring::before { content: ''; position: absolute; inset: 18px;
|
|
147
|
+
border-radius: 50%; background: var(--surface); }
|
|
148
|
+
.coverage-ring-label { position: relative; z-index: 1; text-align: center;
|
|
149
|
+
font-size: 25px; font-weight: 800; line-height: 1.1; }
|
|
150
|
+
.coverage-ring-label small { display: block; font-size: 11px; font-weight: 500;
|
|
151
|
+
color: var(--muted); margin-top: 5px; }
|
|
152
|
+
.coverage-details { display: grid; gap: 7px; font-size: 15px; }
|
|
153
|
+
.coverage-details strong { font-size: 20px; color: var(--blue); }
|
|
154
|
+
.coverage-details .coverage-date { font-size: 12px; color: var(--muted); }
|
|
141
155
|
.section-body-flush { }
|
|
142
156
|
|
|
143
157
|
/* Collapsible sections with preview */
|
|
@@ -619,6 +633,13 @@
|
|
|
619
633
|
}).join('');
|
|
620
634
|
|
|
621
635
|
return hero +
|
|
636
|
+
'<div class="section">' +
|
|
637
|
+
'<div class="section-head">' +
|
|
638
|
+
'<h3>Automation Coverage</h3>' +
|
|
639
|
+
'<p class="section-explain">Automated items divided by all tracked items in the project inventory. Supplied by the project; separate from the test pass rate.</p>' +
|
|
640
|
+
'</div>' +
|
|
641
|
+
'<div class="section-body" id="coverageContent">Coverage data has not been published for this project.</div>' +
|
|
642
|
+
'</div>' +
|
|
622
643
|
'<div class="section">' +
|
|
623
644
|
'<div class="section-head">' +
|
|
624
645
|
'<h3>Recent Test Runs</h3>' +
|
|
@@ -1364,6 +1385,33 @@
|
|
|
1364
1385
|
'<div id="tab-analysis" class="tab-panel">' + renderAnalysis(analytics) + '</div>' +
|
|
1365
1386
|
'<div id="tab-history" class="tab-panel">' + renderHistory(proj.suites || {}) + '</div>';
|
|
1366
1387
|
|
|
1388
|
+
fetch('coverage/' + encodeURIComponent(projectName) + '/latest.json', { cache: 'no-store' })
|
|
1389
|
+
.then(function(r) { if (!r.ok) throw new Error(r.status); return r.json(); })
|
|
1390
|
+
.then(function(coverage) {
|
|
1391
|
+
const total = coverage.total_items;
|
|
1392
|
+
const automated = coverage.automated_items;
|
|
1393
|
+
if (coverage.project_name !== projectName || !Number.isInteger(total) || total < 1 ||
|
|
1394
|
+
!Number.isInteger(automated) || automated < 0 || automated > total) return;
|
|
1395
|
+
const rate = automated / total * 100;
|
|
1396
|
+
const panel = document.getElementById('coverageContent');
|
|
1397
|
+
if (!panel) return;
|
|
1398
|
+
panel.innerHTML = '<div class="coverage-layout">' +
|
|
1399
|
+
'<div class="coverage-ring" id="coverageRing"><div class="coverage-ring-label" id="coverageRate"></div></div>' +
|
|
1400
|
+
'<div class="coverage-details">' +
|
|
1401
|
+
'<div><strong id="coverageAutomated"></strong> automated items</div>' +
|
|
1402
|
+
'<div><span id="coverageManual"></span> not automated items</div>' +
|
|
1403
|
+
'<div><span id="coverageTotal"></span> total tracked items</div>' +
|
|
1404
|
+
'<div class="coverage-date" id="coverageDate"></div>' +
|
|
1405
|
+
'</div></div>';
|
|
1406
|
+
document.getElementById('coverageRing').style.setProperty('--coverage-angle', (rate * 3.6) + 'deg');
|
|
1407
|
+
document.getElementById('coverageRate').innerHTML = rate.toFixed(1) + '%<small>automated</small>';
|
|
1408
|
+
document.getElementById('coverageAutomated').textContent = automated.toLocaleString();
|
|
1409
|
+
document.getElementById('coverageManual').textContent = (total - automated).toLocaleString();
|
|
1410
|
+
document.getElementById('coverageTotal').textContent = total.toLocaleString();
|
|
1411
|
+
document.getElementById('coverageDate').textContent = 'Project inventory as of ' + coverage.as_of;
|
|
1412
|
+
})
|
|
1413
|
+
.catch(function() { /* Coverage is optional; keep the unavailable message. */ });
|
|
1414
|
+
|
|
1367
1415
|
// Trigger first tab animation
|
|
1368
1416
|
requestAnimationFrame(function() {
|
|
1369
1417
|
const panel = document.getElementById('tab-overview');
|
|
@@ -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.4',
|
|
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.4
|
|
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
|
|
@@ -254,6 +254,7 @@ dashboard_max_runs_per_suite = 50 # Run history per suite (default: 50)
|
|
|
254
254
|
| Command | Description |
|
|
255
255
|
|---|---|
|
|
256
256
|
| `test-report publish` | Push latest test run to the store |
|
|
257
|
+
| `test-report publish-coverage` | Publish project-owned automation inventory counts |
|
|
257
258
|
| `test-report deploy` | Deploy static dashboard HTML to the store (run once) |
|
|
258
259
|
| `test-report open` | Open local dashboard in browser |
|
|
259
260
|
| `test-report stats` | Show stats from latest run (reads local SQLite) |
|
|
@@ -322,6 +323,8 @@ retention_days = 90 # Keep 90 days of artifacts and data
|
|
|
322
323
|
|
|
323
324
|
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
325
|
|
|
326
|
+
Projects can also publish QA-maintained automation inventory counts with `test-report publish-coverage --config reporting-jenkins.ini --file coverage.json`. The dashboard and monthly reports show the resulting automation coverage separately from test pass rates. See [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md#project-supplied-automation-coverage) for the file format and publishing steps.
|
|
327
|
+
|
|
325
328
|
For AWS SSO setup, commands, date selection, and metric definitions, see [MONTHLY_REPORTS.md](MONTHLY_REPORTS.md).
|
|
326
329
|
|
|
327
330
|
---
|
|
@@ -16,6 +16,7 @@ from reporting.monthly_report import MonthlyReportGenerator
|
|
|
16
16
|
from reporting.monthly_ui import make_handler
|
|
17
17
|
from reporting.run_source import PublishedRunSource
|
|
18
18
|
from reporting.pdf_analysis import build_pdf_analysis
|
|
19
|
+
from reporting.coverage import CoverageStore, validate_coverage
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class PublishedMonthlyReportTests(unittest.TestCase):
|
|
@@ -66,6 +67,81 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
66
67
|
self.assertTrue(metrics['summary']['detail_complete'])
|
|
67
68
|
self.assertEqual(metrics['failure_types'][0]['count'], 1)
|
|
68
69
|
|
|
70
|
+
def test_coverage_snapshots_are_project_scoped_and_time_aware(self):
|
|
71
|
+
self.config.PROJECT_NAME = 'Project A'
|
|
72
|
+
store = CoverageStore(self.config)
|
|
73
|
+
source = self.config.STORE_PATH / 'coverage-input.json'
|
|
74
|
+
source.write_text(json.dumps({'as_of': '2026-10-01', 'total_items': 120,
|
|
75
|
+
'automated_items': 48}), encoding='utf-8')
|
|
76
|
+
snapshot = store.publish(source)
|
|
77
|
+
self.assertEqual(snapshot['coverage_percent'], 40.0)
|
|
78
|
+
self.assertEqual(snapshot['not_automated_items'], 72)
|
|
79
|
+
self.assertIsNone(store.as_of('Project A', '2026-09-30'))
|
|
80
|
+
self.assertEqual(store.as_of('Project A', '2026-10-31')['automated_items'], 48)
|
|
81
|
+
source.write_text(json.dumps({'as_of': '2026-10-15', 'total_items': 120,
|
|
82
|
+
'automated_items': 60}), encoding='utf-8')
|
|
83
|
+
store.publish(source)
|
|
84
|
+
self.assertEqual(store.as_of('Project A', '2026-10-10')['automated_items'], 48)
|
|
85
|
+
self.assertEqual(store.as_of('Project A', '2026-10-31')['automated_items'], 60)
|
|
86
|
+
source.write_text(json.dumps({'as_of': '2026-09-01', 'total_items': 120,
|
|
87
|
+
'automated_items': 35}), encoding='utf-8')
|
|
88
|
+
store.publish(source)
|
|
89
|
+
latest = json.loads((self.config.STORE_PATH / 'coverage' / 'Project A' /
|
|
90
|
+
'latest.json').read_text(encoding='utf-8'))
|
|
91
|
+
self.assertEqual(latest['as_of'], '2026-10-15')
|
|
92
|
+
|
|
93
|
+
def test_coverage_rejects_invalid_or_mismatched_counts(self):
|
|
94
|
+
with self.assertRaisesRegex(ValueError, 'total_items'):
|
|
95
|
+
validate_coverage({'as_of': '2026-10-01', 'total_items': 10,
|
|
96
|
+
'automated_items': 11}, 'Project A')
|
|
97
|
+
with self.assertRaisesRegex(ValueError, 'total_items'):
|
|
98
|
+
validate_coverage({'as_of': '2026-10-01', 'total_items': True,
|
|
99
|
+
'automated_items': 1}, 'Project A')
|
|
100
|
+
with self.assertRaisesRegex(ValueError, 'match reporting.ini'):
|
|
101
|
+
validate_coverage({'project_name': 'Project B', 'as_of': '2026-10-01',
|
|
102
|
+
'total_items': 10, 'automated_items': 1}, 'Project A')
|
|
103
|
+
|
|
104
|
+
def test_s3_coverage_uses_separate_project_keys(self):
|
|
105
|
+
class MissingKey(Exception):
|
|
106
|
+
response = {'Error': {'Code': 'NoSuchKey'}}
|
|
107
|
+
|
|
108
|
+
class S3Client:
|
|
109
|
+
def __init__(self):
|
|
110
|
+
self.objects = {}
|
|
111
|
+
|
|
112
|
+
def put_object(self, **kwargs):
|
|
113
|
+
self.objects[kwargs['Key']] = kwargs['Body']
|
|
114
|
+
|
|
115
|
+
def get_object(self, **kwargs):
|
|
116
|
+
key = kwargs['Key']
|
|
117
|
+
if key not in self.objects:
|
|
118
|
+
raise MissingKey()
|
|
119
|
+
return {'Body': io.BytesIO(self.objects[key])}
|
|
120
|
+
|
|
121
|
+
def get_paginator(self, operation):
|
|
122
|
+
self.operation = operation
|
|
123
|
+
return self
|
|
124
|
+
|
|
125
|
+
def paginate(self, **kwargs):
|
|
126
|
+
return [{'Contents': [{'Key': key} for key in self.objects
|
|
127
|
+
if key.startswith(kwargs['Prefix'])]}]
|
|
128
|
+
|
|
129
|
+
config = SimpleNamespace(STORE_TYPE='s3', STORE_PATH=Path(self.tmp.name),
|
|
130
|
+
PROJECT_NAME='Project A', S3_PREFIX='prod',
|
|
131
|
+
S3_BUCKET='bucket', S3_REGION='us-east-1')
|
|
132
|
+
client = S3Client()
|
|
133
|
+
source = config.STORE_PATH / 'coverage-input.json'
|
|
134
|
+
source.write_text(json.dumps({'as_of': '2026-10-01', 'total_items': 20,
|
|
135
|
+
'automated_items': 8}), encoding='utf-8')
|
|
136
|
+
store = CoverageStore(config, s3_client=client)
|
|
137
|
+
store.publish(source)
|
|
138
|
+
self.assertEqual(sorted(client.objects), [
|
|
139
|
+
'prod/coverage/Project A/2026-10-01.json',
|
|
140
|
+
'prod/coverage/Project A/latest.json',
|
|
141
|
+
])
|
|
142
|
+
self.assertEqual(store.as_of('Project A', '2026-10-01')['coverage_percent'], 40.0)
|
|
143
|
+
self.assertIsNone(store.as_of('Project A', '2026-09-30'))
|
|
144
|
+
|
|
69
145
|
def test_incomplete_detail_does_not_create_misleading_test_metrics(self):
|
|
70
146
|
run_path = self.config.STORE_PATH / 'runs' / 'Project A' / 'current.json'
|
|
71
147
|
run = json.loads(run_path.read_text(encoding='utf-8'))
|
|
@@ -183,6 +259,11 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
183
259
|
@unittest.skipUnless(all(importlib.util.find_spec(x) for x in ('pptx', 'openpyxl', 'reportlab')),
|
|
184
260
|
'Install test-reporting[reports] to test exports')
|
|
185
261
|
def test_generate_all_formats_with_previous_period(self):
|
|
262
|
+
self.config.PROJECT_NAME = 'Project A'
|
|
263
|
+
coverage_file = self.config.STORE_PATH / 'coverage-input.json'
|
|
264
|
+
coverage_file.write_text(json.dumps({'as_of': '2026-10-01', 'total_items': 20,
|
|
265
|
+
'automated_items': 8}), encoding='utf-8')
|
|
266
|
+
CoverageStore(self.config).publish(coverage_file)
|
|
186
267
|
generator = MonthlyReportGenerator(self.config)
|
|
187
268
|
files = generator.generate('2026-10-01', '2026-10-01', project='Project A',
|
|
188
269
|
formats=['pdf', 'pptx', 'xlsx'],
|
|
@@ -194,11 +275,14 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
194
275
|
workbook = load_workbook(next(p for p in files if p.suffix == '.xlsx'))
|
|
195
276
|
self.assertNotIn('Recommendations', workbook.sheetnames)
|
|
196
277
|
self.assertEqual(workbook['Summary']['A24'].value, 'KEY FINDINGS')
|
|
278
|
+
self.assertEqual(workbook['Summary']['B22'].value, '40.0%')
|
|
279
|
+
self.assertEqual(workbook['Automation Coverage']['B5'].value, 8)
|
|
197
280
|
self.assertIn('100.0% pass rate', workbook['Summary']['A25'].value)
|
|
198
281
|
self.assertEqual(workbook['Pass Rate Trend'].freeze_panes, 'B2')
|
|
199
282
|
deck = Presentation(next(p for p in files if p.suffix == '.pptx'))
|
|
200
283
|
self.assertNotIn('Recommendations',
|
|
201
284
|
[slide.shapes.title.text for slide in deck.slides if slide.shapes.title])
|
|
285
|
+
self.assertEqual(deck.slides[2].shapes.title.text, 'Automation Coverage')
|
|
202
286
|
summary_text = ' '.join(shape.text for shape in deck.slides[1].shapes if shape.has_text_frame)
|
|
203
287
|
self.assertIn('KEY FINDINGS', summary_text)
|
|
204
288
|
self.assertIn('100.0% pass rate', summary_text)
|
|
@@ -212,6 +296,11 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
212
296
|
|
|
213
297
|
@unittest.skipUnless(importlib.util.find_spec('reportlab'), 'Install test-reporting[reports]')
|
|
214
298
|
def test_executive_summary_is_short_pdf_with_period_measures(self):
|
|
299
|
+
self.config.PROJECT_NAME = 'Project A'
|
|
300
|
+
coverage_file = self.config.STORE_PATH / 'coverage-input.json'
|
|
301
|
+
coverage_file.write_text(json.dumps({'as_of': '2026-10-01', 'total_items': 20,
|
|
302
|
+
'automated_items': 8}), encoding='utf-8')
|
|
303
|
+
CoverageStore(self.config).publish(coverage_file)
|
|
215
304
|
files = MonthlyReportGenerator(self.config).generate(
|
|
216
305
|
'2026-10-01', '2026-10-01', project='Project A',
|
|
217
306
|
report_type='executive', output_dir=self.config.STORE_PATH / 'exports')
|
|
@@ -225,6 +314,8 @@ class PublishedMonthlyReportTests(unittest.TestCase):
|
|
|
225
314
|
text = ' '.join(page.extract_text() for page in pages)
|
|
226
315
|
self.assertIn('Executive Summary', text)
|
|
227
316
|
self.assertIn('Previous period', text)
|
|
317
|
+
self.assertIn('Automation coverage', text)
|
|
318
|
+
self.assertIn('40.0%', text)
|
|
228
319
|
self.assertNotIn('Test files and test cases', text)
|
|
229
320
|
|
|
230
321
|
def test_executive_summary_rejects_other_formats(self):
|
|
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
|