gangvy 8001621972 Organize test deliverables by coursework units 3 сар өмнө
..
reports 8001621972 Organize test deliverables by coursework units 3 сар өмнө
README.md 8001621972 Organize test deliverables by coursework units 3 сар өмнө
api-contract.api.spec.ts 2fef7b1f26 Add coursework test scripts and reports 3 сар өмнө
run_api_tests.ps1 8001621972 Organize test deliverables by coursework units 3 сар өмнө

README.md

接口测试脚本

测试目标

验证后端 Express API 的基础契约、错误响应和公开配置安全性。

用例范围

接口 测试点 预期
GET /api/health 服务健康检查 200
GET /api/config/parse 返回 Parse 前端配置结构 200
GET /api/config/parse 不暴露 masterKey/restApiKey 不存在敏感字段
GET /api/unknown-resource 未知接口 404
POST /api/ghost 404 消息包含方法与路径 404

合计:5 条。

测试步骤

  1. 进入接口测试目录。
  2. 执行 run_api_tests.ps1
  3. 脚本自动调用后端 Jest + Supertest 测试文件。
  4. 执行完成后查看 reports/ 下的日志和摘要。

运行命令

cd E:\软测\ServicePilot\tests\api_tests
powershell -ExecutionPolicy Bypass -File .\run_api_tests.ps1

验收标准

指标 标准
HTTP 状态码 与接口契约一致
响应结构 字段完整、类型正确
敏感字段 不暴露 masterKeyrestApiKey
接口测试通过率 不低于 95%
输出证据 reports/api_test_log.txtreports/api_test_summary.txt