2.7 KiB
2.7 KiB
全站测试实施计划(2026-06-08)
设计:
docs/design/specs/2026-06-08-full-site-testing-strategy-design.md
用例 SSOT:docs/testing/test-case-matrix.md
MCP 规程:docs/testing/mcp-browser-playbook.md
现状快照
| 资产 | 数量/说明 |
|---|---|
| pytest 文件 | ~60(根目录 tests/test_*.py) |
| 门控 | pre_deploy_check → tests/test_api.py |
| UI E2E | frontend/e2e/full-acceptance.spec.mjs(15 case,serial) |
| 验收聚合 | scripts/run_nexus_acceptance.py + acceptance_catalog.py |
| 前端单测 | 无 vitest |
| MCP | Playwright MCP + MySQL MCP 已配置 |
实施阶段
Phase 1 — 文档与编号(本周)
- 发布
test-case-matrix.md(本文档姊妹篇) - 发布
mcp-browser-playbook.md acceptance_catalog.py增加chainlayer 与executions页
Phase 2 — 目录与标记(1–2 周)
- 新增
tests/unit/、tests/integration/、tests/chain/,新用例只写新目录 pytest.ini或pyproject注册 markers:unit,integration,chain,slow- 从现有文件复制(非搬家)高价值用例各 1 例作为模板
Phase 3 — 集成层现代化(2 周)
tests/integration/conftest.py:AsyncClient+ 测试 DB 事务回滚- 将
test_api.py断言逐步迁为 pytest(保留脚本作门控兼容层) - 契约:关键 API 响应 schema 快照(Pydantic model dump)
Phase 4 — 链条 + UI 拆分(2–3 周)
tests/chain/test_push_async_flow.py:POST accepted → WS progress mocktests/chain/test_script_exec_flow.py:创建脚本 → 执行 → 看板状态- 拆分
full-acceptance.spec.mjs→frontend/e2e/pages/*.spec.mjs - 新增
flows/push-submit.spec.mjs(非破坏性)
Phase 5 — CI 与 MCP 闭环(持续)
.gitea/workflows/ci-cd.yml增加pytest -m "not chain and not slow"- nightly:
run_nexus_acceptance.py --with-unit --with-ui - 每个 sprint 选 3 条
MCP-*沉淀为 Playwright
本地命令速查
# L1 单元
pytest tests/unit tests/test_posix_paths.py -q -m unit
# L2 集成(需 docker + start-dev)
pytest tests/integration -q -m integration
# L3 链条
pytest tests/chain -q -m chain
# L4 UI
cd frontend && NEXUS_E2E_BASE=http://127.0.0.1:8600 NEXUS_E2E_PASSWORD=*** npm run test:e2e
# 全量验收
python scripts/run_nexus_acceptance.py --with-unit --with-ui
回滚
- 新目录与 marker 均为增量;删除
tests/unit等不影响现门控 test_api.py在迁移完成前保持不动
测试要点(实施自检)
- 任意新功能 PR 必须标明影响的用例编号(如
IT-PUSH-003) - MCP 探索报告路径:
docs/reports/mcp-runs/YYYY-MM-DD-<id>.md