Files
cobol-java-v3/test-data/run_coverage_measure.py
NB-076 50995d3335 chore: SETUP.md + 测试报告脚本 + 文档更新
- SETUP.md: 完整环境搭建指南(同事用)
- SETUP_QUICK.md: 快速搭环境(4步)
- s22~s26: TNA端到端、覆盖率报告、回归检查
- procedure_grammar.lark: 实验性Lark语法

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 08:50:17 +08:00

54 lines
1.7 KiB
Python

"""Run all test suites under coverage measurement"""
import subprocess, sys, glob
tests = [
"test-data/round2_remaining_tests.py",
"test-data/round3_deep_coverage.py",
"test-data/r4_deep_coverage.py",
"test-data/r4_design_coverage.py",
"test-data/r4_cond_coverage.py",
"test-data/r4_coverage_coverage.py",
"test-data/r5_integration_coverage.py",
"test-data/r6_deep_coverage.py",
"test-data/r7_final_deep.py",
"test-data/r8_env_coverage.py",
"test-data/r9_deep_coverage.py",
"test-data/r10_pipeline_agent.py",
"test-data/r11_real_verification.py",
"test-data/r12_real_cobol_pipeline.py",
"test-data/r12b_orchestrator_e2e.py",
"test-data/r13_final_sweep.py",
]
for t in tests:
r = subprocess.run(
[sys.executable, "-m", "coverage", "run", "--append", "--parallel-mode", "-p", t],
capture_output=True, text=True, timeout=300
)
if r.returncode != 0:
print(f"FAIL {t}: {r.stderr[:100]}")
else:
print(f"OK {t}")
# Combine data files
subprocess.run([sys.executable, "-m", "coverage", "combine"], capture_output=True)
print("\nCoverage data combined. Generating report...")
# Generate report
r = subprocess.run(
[sys.executable, "-m", "coverage", "report", "--show-missing",
"--omit=test-data/*,__pycache__/*,tests/*"],
capture_output=True, text=True, timeout=60
)
print(r.stdout[-2000:] if len(r.stdout) > 2000 else r.stdout)
if r.stderr:
print("STDERR:", r.stderr[:500])
# Generate HTML
subprocess.run(
[sys.executable, "-m", "coverage", "html", "--omit=test-data/*,__pycache__/*,tests/*",
"-d", "coverage_report"],
capture_output=True, text=True, timeout=60
)
print("HTML report: coverage_report/index.html")