فهرست منبع

Add performance test markdown report

gangvy 3 ماه پیش
والد
کامیت
0abfdeaeea

+ 1 - 0
tests/README.md

@@ -135,6 +135,7 @@ powershell -ExecutionPolicy Bypass -File .\run_frontend_performance.ps1
 结果输出:
 
 ```text
+tests/performance_tests/性能测试报告.md
 tests/performance_tests/reports/backend-performance-report.html
 tests/performance_tests/reports/backend-performance_*.csv
 tests/performance_tests/reports/frontend-performance-report.html

+ 1 - 0
tests/performance_tests/README.md

@@ -44,6 +44,7 @@ powershell -ExecutionPolicy Bypass -File .\run_frontend_performance.ps1
 ## 输出证据
 
 ```text
+tests/performance_tests/性能测试报告.md
 tests/performance_tests/reports/backend-performance-report.html
 tests/performance_tests/reports/backend-performance_*.csv
 tests/performance_tests/reports/frontend-performance-report.html

+ 80 - 0
tests/performance_tests/性能测试报告.md

@@ -0,0 +1,80 @@
+# ServicePilot 性能测试报告
+
+## 一、测试目的
+
+使用 Locust 对 ServicePilot 后端接口和前端关键页面进行并发访问测试,验证系统在课程实践规模下的响应时间、吞吐量、失败率和稳定性是否满足综合测试验收标准。
+
+## 二、测试环境
+
+| 项目 | 内容 |
+|---|---|
+| 测试工具 | Locust 2.44.1 |
+| 执行时间 | 2026-06-08 16:16 至 16:22 |
+| 后端地址 | `http://localhost:3000` |
+| 前端地址 | `http://127.0.0.1:4301` |
+| 并发配置 | 30 用户,启动速率 5 用户/秒,持续 3 分钟 |
+| 结果输出 | HTML 报告、CSV 明细、TXT 摘要 |
+
+## 三、测试场景
+
+### 1. 后端接口性能测试
+
+| 场景 | 权重 | 验证点 |
+|---|---:|---|
+| `GET /api/health` | 5 | 健康检查接口稳定返回 200 |
+| `GET /api/config/parse` | 3 | Parse 前端配置接口稳定返回公开配置 |
+| `GET /api/unknown-resource` | 1 | 404 契约接口稳定返回错误结构 |
+
+### 2. 前端页面性能测试
+
+| 页面 | 验证点 |
+|---|---|
+| `/dashboard` | 工作台页面可稳定访问 |
+| `/tickets` | 工单管理页面可稳定访问 |
+| `/sla` | SLA 管理页面可稳定访问 |
+| `/knowledge` | 知识库页面可稳定访问 |
+| `/files` | 附件管理页面可稳定访问 |
+| `/reviews` | 满意度页面可稳定访问 |
+| `/test-plan` | 测试计划页面可稳定访问 |
+
+## 四、执行命令
+
+```powershell
+cd E:\软测\ServicePilot\tests\performance_tests
+pip install -r requirements.txt
+powershell -ExecutionPolicy Bypass -File .\run_backend_performance.ps1
+powershell -ExecutionPolicy Bypass -File .\run_frontend_performance.ps1
+```
+
+## 五、测试结果
+
+| 测试对象 | 请求总数 | 失败请求数 | 失败率 | 平均响应时间 | P95 响应时间 | 最大响应时间 | 吞吐量 | 结论 |
+|---|---:|---:|---:|---:|---:|---:|---:|---|
+| 后端接口 | 2656 | 0 | 0% | 2.77 ms | 4 ms | 60.94 ms | 14.84 req/s | 通过 |
+| 前端页面 | 24311 | 0 | 0% | 4.29 ms | 9 ms | 58.18 ms | 135.88 req/s | 通过 |
+
+## 六、验收标准对照
+
+| 验收指标 | 标准 | 后端结果 | 前端结果 | 是否通过 |
+|---|---|---:|---:|---|
+| 平均响应时间 | 小于 500ms | 2.77 ms | 4.29 ms | 通过 |
+| P95 响应时间 | 小于 1000ms | 4 ms | 9 ms | 通过 |
+| 错误率 | 小于 1% | 0% | 0% | 通过 |
+| 服务稳定性 | 压测期间不崩溃 | 稳定 | 稳定 | 通过 |
+
+## 七、结果证据
+
+| 文件 | 说明 |
+|---|---|
+| `reports/backend-performance-report.html` | 后端接口 Locust HTML 报告 |
+| `reports/backend-performance_stats.csv` | 后端接口统计明细 |
+| `reports/backend-performance_stats_history.csv` | 后端接口历史曲线数据 |
+| `reports/backend_performance_summary.txt` | 后端接口性能摘要 |
+| `reports/frontend-performance-report.html` | 前端页面 Locust HTML 报告 |
+| `reports/frontend-performance_stats.csv` | 前端页面统计明细 |
+| `reports/frontend-performance_stats_history.csv` | 前端页面历史曲线数据 |
+| `reports/frontend_performance_summary.txt` | 前端页面性能摘要 |
+
+## 八、结论
+
+本次性能测试中,后端接口和前端页面均完成 30 用户、持续 3 分钟的并发访问测试,两组测试失败率均为 0%,平均响应时间和 P95 响应时间均明显低于验收阈值。综合判断 ServicePilot 在课程实践规模下具备稳定的访问性能,性能测试结论为通过。

+ 1 - 1
tests/提交结构说明.md

@@ -7,7 +7,7 @@
 | 单元测试 | `unit_tests/` | `run_unit_tests.ps1` | `reports/unit_test_log.txt`、`reports/unit_test_summary.txt` |
 | 接口测试 | `api_tests/` | `run_api_tests.ps1` | `reports/api_test_log.txt`、`reports/api_test_summary.txt` |
 | 自动化测试 | `auto_tests/` | `run_auto_tests.ps1` | `reports/auto_test_log.txt`、`artifacts/*.png`、`artifacts/auto-test-result.json` |
-| 性能测试 | `performance_tests/` | `run_backend_performance.ps1`、`run_frontend_performance.ps1` | `reports/*.html`、`reports/*.csv` 或 `reports/*_performance_pending.txt` |
+| 性能测试 | `performance_tests/` | `run_backend_performance.ps1`、`run_frontend_performance.ps1` | `性能测试报告.md`、`reports/*.html`、`reports/*.csv`、`reports/*_summary.txt` |
 
 ## 提交口径
 

+ 1 - 0
tests/测试结果汇总.md

@@ -134,6 +134,7 @@ tests/auto_tests/artifacts/
 
 ```text
 tests/performance_tests/requirements.txt
+tests/performance_tests/性能测试报告.md
 tests/performance_tests/reports/backend-performance-report.html
 tests/performance_tests/reports/backend-performance_stats.csv
 tests/performance_tests/reports/backend_performance_summary.txt