测试管理与 CI
TestRail、Allure、Jenkins。
30 分钟
测试管理与 CI
测试不仅是写脚本,还需要 用例管理、报告、流水线集成 与可追溯的发布门禁。对照 /roadmaps/qa「Test Management & CI」节点,本课介绍 TestRail、Allure 与 Jenkins/GitHub Actions 实践。
学习目标
- 理解测试管理工具中的用例、计划、运行与缺陷关联
- 用 Allure 或 Surefire 报告呈现测试结果
- 设计 CI 中测试阶段:快测 PR 门禁、慢测 nightly
- 将本站
ci.yml与 QA 流程对照
核心概念
测试管理(TestRail 等)
| 对象 | 说明 |
|---|---|
| 用例库 | 结构化步骤、预期、优先级 |
| 测试计划 | 某版本/迭代的执行范围 |
| 测试运行 | 实际执行记录 pass/fail |
| 缺陷关联 | fail 一键建 ticket,双向追溯 |
手工与自动化用例可 同一库管理:自动化 ID 映射到 TestRail case ID。
报告(Allure)
<!-- pom.xml 片段 -->
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
</plugin>
@Epic("Tracks")
@Feature("查询")
@Test
@DisplayName("按 slug 返回 200")
void getBySlug_ok() { ... }
Allure 聚合 JUnit、REST Assured、Playwright 结果,生成趋势与失败附件(截图、日志)。
CI 分层
| 阶段 | 触发 | 内容 |
|---|---|---|
| PR 门禁 | 每次 push | mvn test、npm test(分钟级) |
| 集成 | merge develop | mvn verify -Pintegration |
| Nightly | cron | E2E、性能抽检、ZAP 基线 |
本站 .github/workflows/ci.yml:backend mvn -B verify、platform npm test,即 最小 QA 门禁。Jenkins 常见于企业内网;GitHub Actions 与 PR 深度集成——原则一致:失败阻断合并、报告可归档。扩展见 test-ci。
与 testing-essentials/Spring 对照
| QA 工具链 | 本站 testing 实践 |
|---|---|
| Surefire 报告 | backend/target/surefire-reports |
| Allure 注解 | JUnit 5 @DisplayName、test-junit |