除员工外 取消导入更新 添加导入文件重复校验

This commit is contained in:
wkc
2026-02-09 09:10:35 +08:00
parent 886176ed7e
commit 8efbd43abd
21 changed files with 4231 additions and 32 deletions

127
doc/test-reports/README.md Normal file
View File

@@ -0,0 +1,127 @@
# 测试报告目录
本目录用于存放自动化测试生成的测试报告。
## 报告命名规范
```
test_report_YYYYMMDD_HHMMSS.json
```
例如: `test_report_20260209_153045.json`
## 报告内容
每个测试报告包含以下信息:
- test_time: 测试时间
- environment: 测试环境URL
- total_count: 总测试用例数
- passed_count: 通过的用例数
- failed_count: 失败的用例数
- pass_rate: 通过率
- results: 详细测试结果列表
## 查看报告
### 方式1: 文本编辑器
使用任何文本编辑器打开JSON文件即可查看。
### 方式2: JSON格式化工具
使用在线JSON格式化工具或IDE的JSON插件进行格式化查看:
- https://jsoneditoronline.org/
- https://www.json.cn/
### 方式3: Python脚本解析
```python
import json
with open('doc/test-reports/test_report_20260209_153045.json', 'r', encoding='utf-8') as f:
report = json.load(f)
print(f"测试时间: {report['test_time']}")
print(f"通过率: {report['pass_rate']}")
for result in report['results']:
print(f"- {result['name']}: {'通过' if result['passed'] else '失败'}")
```
## 报告分析
### 查看通过率
```json
"pass_rate": "75.0%"
```
通过率 >= 80% 表示测试基本通过
### 查看失败的测试用例
在results数组中查找 "passed": false 的记录
### 查看错误原因
每个测试用例的error_message字段包含失败原因
### 查看详细数据
每个测试用例的details字段包含:
- expected_success/expected_failure: 预期结果
- actual_success/actual_failure: 实际结果
- failures: 失败记录列表
## 历史报告管理
建议定期清理旧的测试报告:
```bash
# 删除7天前的报告
find doc/test-reports -name "test_report_*.json" -mtime +7 -delete
# Windows PowerShell
Get-ChildItem doc/test-reports -Filter "test_report_*.json" |
Where-Object LastWriteTime -lt (Get-Date).AddDays(-7) |
Remove-Item
```
## 测试趋势分析
通过对比不同时间的测试报告,可以分析:
1. 功能稳定性: 通过率是否保持在高水平
2. 回归问题: 之前通过的测试是否开始失败
3. 新增问题: 新功能是否引入了测试失败
## 归档建议
- 每次版本发布前保留一份测试报告
- 重大功能更新后保留测试报告
- 定期(如每月)归档历史报告到单独目录
## 示例报告结构
```json
{
"test_time": "2026-02-09 15:30:45",
"environment": "http://localhost:8080",
"total_count": 4,
"passed_count": 4,
"failed_count": 0,
"pass_rate": "100.0%",
"results": [
{
"name": "采购交易 - Excel内采购事项ID重复",
"description": "测试导入3条采购事项ID相同的记录...",
"passed": true,
"error_message": null,
"details": {
"expected_success": 1,
"expected_failure": 2,
"actual_success": 1,
"actual_failure": 2,
"failures": [
{
"purchaseId": "PURCHASE001",
"errorMessage": "采购事项ID[PURCHASE001]在导入文件中重复,已跳过此条记录"
}
]
},
"duration": "5.23s"
}
]
}
```