@@ -194,6 +194,75 @@ In a GitHub Actions workflow::
194194
195195-----------
196196
197+ **********************
198+ Test budget by stage
199+ **********************
200+
201+ Estimate CPU-hour cost per stage from v2 test history mean CPU times::
202+
203+ from ucis.ncdb.ncdb_ucis import NcdbUCIS
204+ from ucis.ncdb.testplan import get_testplan
205+ from ucis.ncdb.reports import report_test_budget, format_test_budget
206+
207+ db = NcdbUCIS("coverage.cdb")
208+ plan = db.getTestplan()
209+ rpt = report_test_budget(plan, db)
210+ print(format_test_budget(rpt))
211+
212+ # JSON export
213+ import json
214+ print(json.loads(rpt.to_json())["stage_totals"])
215+
216+ Testpoints whose tests have no CPU time recorded appear in
217+ ``rpt.missing_stats ``.
218+
219+ -----------
220+
221+ **********************
222+ Safety traceability matrix
223+ **********************
224+
225+ Build a requirement-to-testpoint matrix (suitable for safety audits)::
226+
227+ from ucis.ncdb.reports import report_safety_matrix, format_safety_matrix
228+
229+ rpt = report_safety_matrix(results) # results from compute_closure
230+ print(format_safety_matrix(rpt))
231+
232+ # CSV for a spreadsheet or audit tool
233+ with open("traceability.csv", "w") as f:
234+ f.write(rpt.to_csv())
235+
236+ # Add a WaiverSet to flag waived testpoints
237+ from ucis.ncdb.waivers import WaiverSet
238+ waivers = WaiverSet.from_file("waivers.hjson")
239+ rpt = report_safety_matrix(results, waivers=waivers)
240+
241+ -----------
242+
243+ **********************
244+ Seed reliability heat-map
245+ **********************
246+
247+ Identify seeds that are disproportionately flaky::
248+
249+ from ucis.ncdb.ncdb_ucis import NcdbUCIS
250+ from ucis.ncdb.reports import report_seed_reliability, format_seed_reliability
251+
252+ db = NcdbUCIS("coverage.cdb")
253+ rpt = report_seed_reliability(db, "uart_smoke")
254+ print(format_seed_reliability(rpt))
255+ # Seeds with flake_score ≥ 0.2 are flagged with ⚠
256+
257+ # JSON heat-map for a custom dashboard
258+ import json
259+ data = json.loads(rpt.to_json())
260+ for row in data["rows"]:
261+ if row["flake"] >= 0.2:
262+ print(f"Seed {row['seed']}: {row['fail']} failures")
263+
264+ -----------
265+
197266**********************
198267GitHub Step Summary
199268**********************
@@ -241,6 +310,18 @@ API reference
241310.. autofunction :: ucis.ncdb.reports.format_coverage_contribution
242311.. autoclass :: ucis.ncdb.reports.CoverageContribution
243312
313+ .. autofunction :: ucis.ncdb.reports.report_test_budget
314+ .. autofunction :: ucis.ncdb.reports.format_test_budget
315+ .. autoclass :: ucis.ncdb.reports.TestBudget
316+
317+ .. autofunction :: ucis.ncdb.reports.report_safety_matrix
318+ .. autofunction :: ucis.ncdb.reports.format_safety_matrix
319+ .. autoclass :: ucis.ncdb.reports.SafetyMatrix
320+
321+ .. autofunction :: ucis.ncdb.reports.report_seed_reliability
322+ .. autofunction :: ucis.ncdb.reports.format_seed_reliability
323+ .. autoclass :: ucis.ncdb.reports.SeedReliability
324+
244325.. autofunction :: ucis.ncdb.testplan_export.export_junit_xml
245326.. autofunction :: ucis.ncdb.testplan_export.export_github_annotations
246327.. autofunction :: ucis.ncdb.testplan_export.export_summary_markdown
0 commit comments