You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
单元测试计划( Unit Test Plan)
1. 目标
验证控制器与服务层的核心逻辑与数据契约稳定性,确保已实现功能按预期工作。
2. 范围
- 控制器:`DeptController`、`EmployeeController`、`EmployeeKpiController`、`HireNumController`、`SalaryLevelController`、`LoginController`、`CaptchaController`;
- 服务:对应的 `I*Service` 及其 `impl`;
3. 测试类型
- 正向用例: CRUD 成功路径;
- 反向用例: 非法ID、缺失字段、验证码错误/过期、未携带token;
- 边界场景:分页页码/大小边界、批量删除空集合/超长集合;
4. 工具与环境
- 后端: Spring Boot Test + MockMvc;
- 数据: H2或测试库, 初始化测试数据( 或使用Mock Mapper/Repo) ;
5. 测试用例(示例级别)
5.1 验证码
- GET /captchaImage: 应返回 `uuid` 与 `img(Base64)`, 并在Redis写入键;
5.2 登录
- 正常:正确的 `{username,password,code,uuid}` → 返回 `code=200` 且包含 `token`;
- 异常:验证码错误/过期 → 返回非200;
5.3 部门信息管理
- list: 普通查询分页;
- get: 存在ID返回详情, 不存在ID返回空或错误码;
- add/update: 字段类型与业务约束验证;
- delete: 单/多ID删除后验证数量变化;
5.4 员工信息管理(含事务)
- update: 在事务内抛异常时应回滚, 数据保持一致;
5.5 员工评价 / 招人名额 / 薪资标准
- 与部门/员工一致的CRUD用例模板;
6. 通过标准
- 所有正向用例通过;
- 关键反向与边界用例通过;
7. 持续集成
- 建议在提交时触发单测,报告覆盖率;