Files
Nexus/docs/design/plans/2026-06-08-full-site-testing-strategy.md
2026-07-08 22:31:31 +08:00

79 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 全站测试实施计划(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 caseserial |
| 验收聚合 | `scripts/run_nexus_acceptance.py` + `acceptance_catalog.py` |
| 前端单测 | 无 vitest |
| MCP | Playwright MCP + MySQL MCP 已配置 |
## 实施阶段
### Phase 1 — 文档与编号(本周)
1. 发布 `test-case-matrix.md`(本文档姊妹篇)
2. 发布 `mcp-browser-playbook.md`
3. `acceptance_catalog.py` 增加 `chain` layer 与 `executions`
### Phase 2 — 目录与标记(12 周)
1. 新增 `tests/unit/``tests/integration/``tests/chain/`**新用例只写新目录**
2. `pytest.ini``pyproject` 注册 markers`unit`, `integration`, `chain`, `slow`
3. 从现有文件**复制**(非搬家)高价值用例各 1 例作为模板
### Phase 3 — 集成层现代化(2 周)
1. `tests/integration/conftest.py``AsyncClient` + 测试 DB 事务回滚
2.`test_api.py` 断言逐步迁为 pytest(保留脚本作门控兼容层)
3. 契约:关键 API 响应 schema 快照(Pydantic model dump
### Phase 4 — 链条 + UI 拆分(23 周)
1. `tests/chain/test_push_async_flow.py`POST accepted → WS progress mock
2. `tests/chain/test_script_exec_flow.py`:创建脚本 → 执行 → 看板状态
3. 拆分 `full-acceptance.spec.mjs``frontend/e2e/pages/*.spec.mjs`
4. 新增 `flows/push-submit.spec.mjs`(非破坏性)
### Phase 5 — CI 与 MCP 闭环(持续)
1. `.gitea/workflows/ci-cd.yml` 增加 `pytest -m "not chain and not slow"`
2. nightly`run_nexus_acceptance.py --with-unit --with-ui`
3. 每个 sprint 选 3 条 `MCP-*` 沉淀为 Playwright
## 本地命令速查
```bash
# 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`