Files
admin 4b03ba329a feat: M5-005 API接口自动化测试框架
- pytest + httpx + pytest-asyncio 框架
- 5模块测试脚手架(产品/项目/文档/流程/报表)
- 76个基础测试用例(test-cases.md)
- 测试大纲(test-plan.md)
- 测试报告模板(test-report-template.md)
- 出入库记录(test-data-log.md)
- API端点推断清单(m5-api-endpoints.md)
- 用例验证器(helpers/validators.py)
- 测试数据生成器(fixtures/data.py)
- 脚本:run_tests.sh, generate_report.sh
- 文档:README.md, FOLLOWUP.md
2026-04-09 16:21:27 +08:00
..

M5 接口自动化测试框架

快速开始

1. 安装依赖

cd m5-auto-test
pip install -r requirements.txt

2. 配置环境变量(可选)

cp .env.example .env
# 编辑 .env 文件,填写 API_BASE_URL 和认证信息

3. 运行测试

# 运行所有测试
pytest -v

# 生成 HTML 报告
pytest -v --html=reports/report.html

# 使用 Allure可选
pytest -v --alluredir=reports/allure
allure serve reports/allure

4. 查看报告

  • pytest 报告:reports/pytest-report.html
  • 覆盖率报告:reports/coverage/index.html

测试覆盖模块

模块 文件 状态
产品管理 tests/v1/test_products.py ⚠️ 待填充
项目管理 tests/v1/test_projects.py ⚠️ 待填充
文档管理 tests/v1/test_documents.py ⚠️ 待填充
流程管理 tests/v1/test_workflows.py ⚠️ 待填充
报表分析 tests/v1/test_reports.py ⚠️ 待填充

已完成项

  • 项目结构搭建
  • 配置文件
  • 认证/未认证客户端 fixtures
  • 响应验证器
  • 示例测试用例(每个模块 6 个)

待完成项

  • 填充具体接口测试用例100+ API
  • 连接真实 API 环境测试
  • 性能测试(可选)
  • 集成 CI/CD可选

负责人:后端工程师 (backend-dev)
最后更新2026-04-07