测试指南
更新:2026-03-13 · 负责人:QA Guild
本文总结 Python + React 技术栈的测试矩阵。
:::tip 相关附录
docs/testing/docker-integration-tests.mddocs/testing/lighteval-interoperability-fixtures.mddocs/testing/docs-smoke-checklist.mddocs/testing/core-alpha-signoff.mddocs/testing/browser-harness-signoff.mddocs/testing/active-runs-hardening-signoff.md:::
覆盖率与门禁
常用命令
后端测试细节
- 单元测试位于
backend/tests pytest -m lighteval用于验证 LightEval config 生成,以及 CLI/Python 互操作pytest -m integration用于运行 Docker-backed stack 的集成测试- 后端覆盖率门禁仍由
backend/pyproject.toml以 branch-aware 方式强制执行
Test doubles
- 本地单元测试仍可以使用 mocks 与 fakes
- Docker 集成测试和 LightEval 契约测试使用本地 OpenAI-compatible test gateway
- 生产代码始终遵循标准 LiteLLM client path
Docker 驱动的集成流程
在仓库根目录运行:
它会执行:
- 启动
postgres、redis、本地 OpenAI-compatible gateway、celery-worker和可选的celery-beat - 应用迁移,并用
eval_752.scripts.seed_integration注入可复现数据 - 在 backend 容器中执行
uv run pytest -m integration - 将 coverage 与日志收集到
.artifacts/docker-integration/
前端测试细节
- Vitest + React Testing Library 覆盖单元与组件行为
- Playwright 覆盖浏览器旅程与 Docker smoke
- Active runs UI 证据由
frontend/tests/manual/active-runs-ui-audit.mjs采集
文档 Smoke
在发布工作流变更前,请执行 docs/testing/docs-smoke-checklist.md 中的文档 smoke checklist。
这条护栏用于避免 getting-started、provider、results、i18n 和 active-runs 文档与实际产品能力漂移。
