Files
iam-service/docs/TEST_REPORT.md
2026-01-31 15:44:56 +08:00

45 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 测试报告App 生命周期管理)
## 1) 目标与范围
覆盖本次新增的 App 生命周期管理能力:
- app id/name/type 等输入校验与清洗
- apps 注册表的创建/更新/查询
- 上下线审批(申请/审批/生效)
- 软删除
## 2) 测试类型
### 单元测试(无需数据库)
- `src/services/app.rs`:包含 app_id 等关键字段校验用例
### 集成/冒烟测试(需要 DATABASE_URL
当设置 `DATABASE_URL` 时会执行:
- `tests/enabled_apps_smoke.rs`enabled_apps 读写与版本冲突
- `tests/app_lifecycle_smoke.rs`apps 创建/更新/审批禁用/软删除
若未设置 `DATABASE_URL`,上述集成测试会自动跳过(返回 Ok
## 3) 执行方式
```bash
cargo test
```
若要执行集成测试,需提供可用的 PostgreSQL 连接串,并保证已完成迁移:
```bash
export DATABASE_URL='postgres://...'
./scripts/db/migrate.sh
./scripts/db/verify.sh
cargo test
```
## 4) 结果说明
- 已在当前仓库执行 `cargo test`,测试通过。
- 代码仓库内测试已保持可重复执行,并在无数据库时不阻塞开发体验。
- 覆盖率统计需依赖覆盖率工具(如 cargo-llvm-cov 或 tarpaulin本仓库当前未内置该工具链。