151 lines
17 KiB
Python
151 lines
17 KiB
Python
|
|
"""Build a standalone, searchable QA report from actual retained test evidence.
|
|||
|
|
|
|||
|
|
Exports test names/results only, never JUnit system properties, runtime settings,
|
|||
|
|
credentials, authentication responses or raw request headers.
|
|||
|
|
"""
|
|||
|
|
import datetime as dt
|
|||
|
|
import html
|
|||
|
|
import json
|
|||
|
|
from pathlib import Path
|
|||
|
|
import re
|
|||
|
|
import xml.etree.ElementTree as ET
|
|||
|
|
|
|||
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|||
|
|
DATE = '20261022'
|
|||
|
|
|
|||
|
|
|
|||
|
|
def read(name):
|
|||
|
|
return json.loads((ROOT / name).read_text(encoding='utf-8-sig'))
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main():
|
|||
|
|
groups = []
|
|||
|
|
cases = []
|
|||
|
|
suites = []
|
|||
|
|
for path in sorted((ROOT / 'am-backend').glob('**/target/surefire-reports/TEST-*.xml')):
|
|||
|
|
suite = ET.parse(path).getroot()
|
|||
|
|
suites.append(dict(name=suite.get('name'), tests=int(suite.get('tests', 0)),
|
|||
|
|
failures=int(suite.get('failures', 0)), errors=int(suite.get('errors', 0)),
|
|||
|
|
skipped=int(suite.get('skipped', 0))))
|
|||
|
|
for case in suite.findall('testcase'):
|
|||
|
|
status = 'SKIP' if case.find('skipped') is not None else 'FAIL' if (
|
|||
|
|
case.find('failure') is not None or case.find('error') is not None) else 'PASS'
|
|||
|
|
cases.append(dict(category='后端白盒', name=case.get('classname', '') + '.' + case.get('name', ''),
|
|||
|
|
status=status, durationMs=round(float(case.get('time', 0)) * 1000, 3)))
|
|||
|
|
groups.append(dict(category='后端白盒', total=sum(row['tests'] for row in suites),
|
|||
|
|
passed=sum(row['tests']-row['skipped']-row['failures']-row['errors'] for row in suites),
|
|||
|
|
skipped=sum(row['skipped'] for row in suites), failed=sum(row['failures']+row['errors'] for row in suites),
|
|||
|
|
suites=len(suites), source='Maven JUnit XML,排除系统属性'))
|
|||
|
|
|
|||
|
|
front = (ROOT / '.local/logs/deep-qa-frontend-final.log').read_text(encoding='utf-8')
|
|||
|
|
for name, milliseconds in re.findall(r'^✔ (.*?) \(([\d.]+)ms\)', front, re.M):
|
|||
|
|
cases.append(dict(category='前端自动化', name=name, status='PASS', durationMs=float(milliseconds)))
|
|||
|
|
front_count = int(re.search(r'ℹ tests (\d+)', front)[1])
|
|||
|
|
groups.append(dict(category='前端自动化', total=front_count,
|
|||
|
|
passed=int(re.search(r'ℹ pass (\d+)', front)[1]),
|
|||
|
|
failed=int(re.search(r'ℹ fail (\d+)', front)[1]), skipped=int(re.search(r'ℹ skipped (\d+)', front)[1])))
|
|||
|
|
python = (ROOT / '.local/logs/deep-qa-python-final.log').read_text(encoding='utf-8')
|
|||
|
|
py_names = re.findall(r'^(test_[^\n]+?) \.\.\. ok$', python, re.M)
|
|||
|
|
cases.extend(dict(category='验证工具白盒', name=name, status='PASS') for name in py_names)
|
|||
|
|
py_count = int(re.search(r'Ran (\d+) tests', python)[1])
|
|||
|
|
if len(py_names) != py_count or not re.search(r'^OK$', python, re.M):
|
|||
|
|
raise RuntimeError('Python test evidence incomplete')
|
|||
|
|
groups.append(dict(category='验证工具白盒', total=py_count, passed=py_count, failed=0, skipped=0))
|
|||
|
|
|
|||
|
|
evidence = {}
|
|||
|
|
sources = [('全业务黑盒', '.local/all-features-blackbox.json'),
|
|||
|
|
('HTTP边界探索', '.local/http-boundary-verification.json'),
|
|||
|
|
('扫描文档契约', '.local/scanner-contract-verification.json'),
|
|||
|
|
('原有流程与WS', '.local/deep-qa-native.json'),
|
|||
|
|
('资源调度场景组', '.local/resource-scheduling-verification.json'),
|
|||
|
|
('逐件执行场景组', '.local/deep-qa-scan-only.json'),
|
|||
|
|
('扫描流程场景组', '.local/scanner-workflow-verification.json'),
|
|||
|
|
('导入删除场景组', '.local/import-deletion-verification.json'),
|
|||
|
|
('UI实测', 'docs/deep-qa-ui-20261022.json')]
|
|||
|
|
for category, path in sources:
|
|||
|
|
source = read(path)
|
|||
|
|
rows = source.get('checks', source.get('cases', []))
|
|||
|
|
evidence[category] = source
|
|||
|
|
for row in rows:
|
|||
|
|
cases.append(dict(category=category, name=row['name'], status='PASS' if row['passed'] else 'FAIL',
|
|||
|
|
detail={key:value for key,value in row.items() if key not in ('name','passed')}))
|
|||
|
|
groups.append(dict(category=category, total=len(rows), passed=sum(bool(row['passed']) for row in rows),
|
|||
|
|
failed=sum(not row['passed'] for row in rows), skipped=0, prefix=source.get('prefix'),
|
|||
|
|
requestCount=source.get('requestCount'), source=path))
|
|||
|
|
cleanup = read('.local/deep-qa-cleanup.json')
|
|||
|
|
offline = json.loads((ROOT / '.local/logs/deep-qa-scanner-offline.log').read_text(encoding='utf-8').strip().splitlines()[-1])
|
|||
|
|
builds = dict(
|
|||
|
|
backend='BUILD SUCCESS' in (ROOT / '.local/logs/deep-qa-backend-final.log').read_text(encoding='utf-8', errors='replace'),
|
|||
|
|
frontend=bool(re.search(r'built in [\d.]+s', (ROOT / '.local/logs/deep-qa-web-build.log').read_text(encoding='utf-8'))),
|
|||
|
|
typecheck='error TS' not in (ROOT / '.local/logs/deep-qa-typecheck.log').read_text(encoding='utf-8'))
|
|||
|
|
bugs = [
|
|||
|
|
dict(id='BUG-01', title='操作总超时未约束单次请求和控制锁等待',
|
|||
|
|
reproduce='设置100ms操作预算,模拟任务查询/状态预检延迟700ms;原实现仍接受迟到成功,或在预算耗尽后发送控制。',
|
|||
|
|
fix='共享绝对截止时间,约束锁、预检、任务查询、POST;写入意图后再次检查预算。已受理/结果未知的动作仍保留记录,禁止自动重发。',
|
|||
|
|
regression='ScannerIntegrationTest:慢查询、慢预检、锁等待、慢意图写入、慢受理与继续查询均通过。'),
|
|||
|
|
dict(id='BUG-02', title='远程任务等待未核对任务编号', reproduce='查询任务A,设备返回任务B的succeeded;原实现返回成功。',
|
|||
|
|
fix='处理终态前核对taskId,不匹配返回task_mismatch。', regression='任务编号错配用例通过。'),
|
|||
|
|
dict(id='BUG-03', title='非正数操作预算仍可能访问设备', reproduce='等待接口传入0/-1,原实现可查询或下发后才超时。',
|
|||
|
|
fix='等待和执行入口先拒绝非法预算。', regression='三类入口均在网络与命令记录变更前返回invalid_timeout。'),
|
|||
|
|
dict(id='BUG-04', title='三维网格接受越界顶点索引', reproduce='PLY三角面引用99或-1,而文件仅有3个顶点。',
|
|||
|
|
fix='提交图形前验证每个索引的整数、范围及三角面数量。', regression='越界正负索引均拒绝;正常四边形仍可展开。'),
|
|||
|
|
dict(id='BUG-05', title='缺失三角面的PLY冒充可用网格', reproduce='头部声明1个face,正文只含顶点。',
|
|||
|
|
fix='核对声明面数及索引/展开结果,缺失数据明确报错。', regression='截断面拒绝;逐面颜色PLY和STL/OBJ兼容性通过。'),
|
|||
|
|
dict(id='BUG-06', title='非有限颜色和法向量未拦截', reproduce='坐标有效,但normal/color含NaN。',
|
|||
|
|
fix='检查属性数量和有限数值;在有效几何上计算法向量。', regression='损坏法向量、颜色均拒绝;百万点预览仍正常。'),
|
|||
|
|
dict(id='BUG-07', title='非法日志游标被包装为服务器500', reproduce='afterId=abc或超过Long上限,原接口code=500。',
|
|||
|
|
fix='兼容接口异常层明确处理参数类型不匹配和Bean校验,返回400。', regression='真实Spring MVC参数绑定及最终HTTP边界测试均通过。'),
|
|||
|
|
dict(id='BUG-08', title='显式null/对象/数组参数被当作空请求', reproduce='校验接口requestJson传null、{}或[],原实现静默使用字符串{}。',
|
|||
|
|
fix='字段存在时必须为字符串;省略字段仍保留空对象默认值,并同步路由生成器。', regression='null/对象/数组/数值/布尔拒绝,省略及字符串{}正常。'),
|
|||
|
|
dict(id='BUG-09', title='切换样件弹出canceled误报', reproduce='扫描画面加载时切换样件,页面主动abort旧请求,全局错误处理弹英文错误。',
|
|||
|
|
fix='两套HTTP封装共用取消判定;继续向调用方拒绝取消异常,仅真实网络错误提示。', regression='3项自动化用例通过;页面连续切换9次样件和页签,无误报。'),
|
|||
|
|
dict(id='BUG-10', title='首页新建任务入口实际进入任务池', reproduce='点击新建任务后没有新建表单,而进入任务池。',
|
|||
|
|
fix='中英文文案分别调整为任务池、Task pool。', regression='实际页面文案和点击后的任务池面包屑一致。')]
|
|||
|
|
limits = [
|
|||
|
|
'真实扫描仪地址、端口和访问密钥仍待配置,本轮硬件请求为0。设备状态、图像和三维文件由本机模拟服务提供。',
|
|||
|
|
'本轮证明应用的接口、参数、关联、状态机、异常与资源保护行为;不能替代真实扫描精度、厂家SDK时序和全部标定/编辑操作验收。',
|
|||
|
|
'百万点模型为原始100万点、页面预览50万点;115.6ms为该次浏览器解析测量,0.3ms为几何组装,未声称完整加载时间或稳定帧率。',
|
|||
|
|
'未覆盖多小时浸泡、显卡峰值内存、全部浏览器/显示器组合,以及未来尚未接入的真实电机。',
|
|||
|
|
'后端18项既有跳过测试保持SKIP,已在逐项清单保留,没有计入通过。',
|
|||
|
|
'开发构建仍有原有Monaco等大分包警告和.env.dev中的NODE_ENV提示;构建成功,本轮未扩大到整个编辑器依赖重构。',
|
|||
|
|
'来源项目完整性脚本引用旧主机E:/workspace路径,本机缺少该路径,无法重做跨项目指纹比对;本轮编辑均位于am-freescan。'
|
|||
|
|
]
|
|||
|
|
passed = all(not group['failed'] for group in groups) and cleanup['passed'] and all(builds.values())
|
|||
|
|
report = dict(title='AM FreeScan 详细测试与修复回归报告', date='2026-10-22',
|
|||
|
|
generatedAt=dt.datetime.now().astimezone().isoformat(), passed=passed,
|
|||
|
|
groups=groups, builds=builds, fixes=bugs, cases=cases, backendSuites=suites,
|
|||
|
|
cleanup=cleanup, scannerOffline=offline,
|
|||
|
|
scannerPerformance=evidence['扫描流程场景组'].get('imagePerformance'),
|
|||
|
|
browserPerformance=evidence['UI实测']['performance'],
|
|||
|
|
limitations=limits, evidence=evidence)
|
|||
|
|
json_path = ROOT / f'docs/deep-qa-verification-{DATE}.json'
|
|||
|
|
json_path.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf-8')
|
|||
|
|
body = json.dumps(report, ensure_ascii=False).replace('<', '\\u003c')
|
|||
|
|
page = '''<!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>AM FreeScan 详细测试报告</title>
|
|||
|
|
<style>body{font:15px/1.65 system-ui,sans-serif;color:#1d2b40;background:#f4f7fb;margin:0}main{max-width:1200px;margin:auto;padding:32px}h1{font-size:28px;margin-bottom:8px}h2{font-size:21px;margin-top:32px}.sub{color:#54657c}.card{background:white;border:1px solid #dce4ee;border-radius:10px;padding:20px;margin:16px 0}.ok{color:#08734e}.skip{color:#926400}.fail{color:#b22136}table{border-collapse:collapse;width:100%;font-size:14px}th,td{text-align:left;border-bottom:1px solid #e6ebf2;padding:10px;vertical-align:top}th{background:#f5f8fc;position:sticky;top:0}input,select{padding:10px;border:1px solid #c6d1df;border-radius:5px;font:inherit;max-width:100%}input{width:460px}.filters{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:14px}details{border-top:1px solid #e1e7ef;padding:12px 0}summary{cursor:pointer;font-weight:650}.scroll{max-height:650px;overflow:auto}.metrics{display:flex;gap:20px;flex-wrap:wrap}.metrics strong{font-size:24px;display:block}small{color:#61738c}img{max-width:100%;border:1px solid #dce4ee;border-radius:6px}a{color:#2463b5}code{overflow-wrap:anywhere}@media print{.filters{display:none}.scroll{max-height:none}main{padding:8px}}</style>
|
|||
|
|
<main><h1>AM FreeScan 详细测试与修复回归报告</h1><p class="sub">2026-10-22 · 本机 dev · 黑盒 / 白盒 / UI / 自动化 / 探索性测试</p><div id="summary" class="card"></div><div class="card"><h2>测试范围与结果</h2><p>场景组包含多条断言,不将场景组数量混同于单元测试数量。逐项结果可在下方搜索;跳过项单独列出。</p><table><thead><tr><th>类别</th><th>总数</th><th>通过</th><th>失败</th><th>跳过</th></tr></thead><tbody id="groups"></tbody></table></div>
|
|||
|
|
<div class="card"><h2>本轮发现并修复的问题</h2><div id="bugs"></div></div>
|
|||
|
|
<div class="card"><h2>扫描与三维测量</h2><div id="metrics" class="metrics"></div><p>上述数字来自本轮本机模拟场景,不能推定真实设备吞吐量或扫描质量。</p></div>
|
|||
|
|
<div class="card"><h2>逐项测试清单</h2><div class="filters"><input id="search" placeholder="搜索测试名、步骤、预期或实际结果"><select id="category"><option value="">全部类别</option></select><select id="status"><option value="">全部状态</option><option>PASS</option><option>FAIL</option><option>SKIP</option></select></div><p id="count" class="sub"></p><div class="scroll"><table><thead><tr><th>类别 / 状态</th><th>用例与结果</th><th>用时</th></tr></thead><tbody id="cases"></tbody></table></div></div>
|
|||
|
|
<div class="card"><h2>清理与保留</h2><p id="cleanup"></p><pre id="cleanupCounts"></pre></div>
|
|||
|
|
<div class="card"><h2>界面证据</h2><p>扫描画面由本轮明确标记的本机模拟服务生成。报告和测试业务数据已清理,保留以下验证截图。</p><details><summary>扫描画面放大</summary><img src="images/deep-qa-scanner-live-20261022.png" alt="模拟扫描画面放大验证"></details><details><summary>报告修订及特殊字符</summary><img src="images/deep-qa-report-revision-20261022.png" alt="报告修订验证"></details><details><summary>连续切换无取消误报</summary><img src="images/deep-qa-switching-regression-20261022.png" alt="切换样件回归"></details><details><summary>首页入口修正</summary><img src="images/deep-qa-home-20261022.png" alt="首页入口验证"></details></div>
|
|||
|
|
<div class="card"><h2>验证边界与已有提示</h2><ul id="limits"></ul></div><p><a href="deep-qa-verification-20261022.json">下载完整 JSON 证据</a> · <small id="time"></small></p></main>
|
|||
|
|
<script id="data" type="application/json">__DATA__</script><script>
|
|||
|
|
const report=JSON.parse(document.getElementById('data').textContent),$=id=>document.getElementById(id);function element(tag,text,parent,cls){const e=document.createElement(tag);e.textContent=text;if(cls)e.className=cls;parent.append(e);return e}
|
|||
|
|
element('h2',report.passed?'本轮已执行用例全部通过':'存在待解决项',$('summary'),report.passed?'ok':'fail');element('p','修复10类问题;后端、前端构建及类型检查通过。真实硬件请求为0。',$('summary'));element('p','后端白盒 '+report.groups[0].passed+' 项通过,另有 '+report.groups[0].skipped+' 项跳过。请结合下方验证边界解读。',$('summary'));
|
|||
|
|
for(const g of report.groups){let row=element('tr','',$('groups'));for(const value of [g.category,g.total,g.passed,g.failed,g.skipped])element('td',value,row)}
|
|||
|
|
for(const bug of report.fixes){let d=element('details','',$('bugs'));element('summary',bug.id+' · '+bug.title,d);for(const [key,title] of [['reproduce','复现'],['fix','修复'],['regression','回归']])element('p',title+':'+bug[key],d)}
|
|||
|
|
for(const [value,title] of [[report.browserPerformance.workerParseMs+' ms','百万点线程解析'],[report.browserPerformance.hydrateMs+' ms','页面几何组装'],[report.scannerPerformance.p95Ms+' ms','高清图并发读取 p95'],['0','剩余资源 / 命令占用']]){let d=element('div','',$('metrics'));element('strong',value,d);element('span',title,d)}
|
|||
|
|
for(const g of report.groups){let o=element('option',g.category,$('category'));o.value=g.category}
|
|||
|
|
function render(){const term=$('search').value.toLowerCase(),category=$('category').value,status=$('status').value;const rows=report.cases.filter(c=>(!category||c.category===category)&&(!status||c.status===status)&&JSON.stringify(c).toLowerCase().includes(term));$('cases').replaceChildren();$('count').textContent='显示 '+rows.length+' / '+report.cases.length+' 条记录';for(const c of rows){const tr=element('tr','',$('cases'));let meta=element('td','',tr);element('div',c.category,meta);element('strong',c.status,meta,c.status==='PASS'?'ok':c.status==='SKIP'?'skip':'fail');let detail=element('td','',tr);element('strong',c.name,detail);if(c.detail)for(const [key,value] of Object.entries(c.detail)){element('div',key+':'+(typeof value==='object'?JSON.stringify(value):value),detail)}element('td',c.durationMs==null?'—':c.durationMs+' ms',tr)}}
|
|||
|
|
for(const id of ['search','category','status'])$(id).addEventListener(id==='search'?'input':'change',render);render();$('cleanup').textContent='已核对 '+report.cleanup.batches.length+' 个完整验证批次,无业务测试残留;两条演示任务均完成,永久模拟机器人及设备各保留1条。';$('cleanupCounts').textContent=JSON.stringify(report.cleanup.remaining,null,2);for(const limit of report.limitations)element('li',limit,$('limits'));$('time').textContent='生成时间:'+report.generatedAt;
|
|||
|
|
</script></html>'''
|
|||
|
|
(ROOT / f'docs/deep-qa-report-{DATE}.html').write_text(page.replace('__DATA__', body), encoding='utf-8')
|
|||
|
|
print(json.dumps(dict(passed=passed, groups=groups, cases=len(cases), fixes=len(bugs)), ensure_ascii=False))
|
|||
|
|
if not passed:
|
|||
|
|
raise SystemExit(1)
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == '__main__':
|
|||
|
|
main()
|