feat: 测试开发学习路径上线阶段 2 前两个模块(26 章 / 120 小节)

- 新增 modules/s2-01-go-test(Go 单元测试与 go test 工具链,13 章 / 60 小节)
- 新增 modules/s2-02-go-project-test(Go 项目测试实战:替身、集成与基准,13 章 / 60 小节)
- modules-plan.json 补齐阶段 2 的 6 个模块(其余 4 个标筹备中,保证模块编号与前后衔接正确)
- index.html 的 PAGES 登记 s2-0 / s2-1 路由;阶段 1 最后一个模块的下一跳改为直接进入阶段 2 模块 1
- README 更新进度表与模块表(顺带修正阶段 2/4 的模块数)
- 自检:check-chapter --strict 26 页通过、check-pages 135 页通过、check-glossary 134 页无漂移、portal 注册表通过
This commit is contained in:
2026-10-16 12:52:44 +08:00
parent 1fa6afccfd
commit 100f235e3f
32 changed files with 17665 additions and 7 deletions

View File

@@ -9,9 +9,9 @@
|---|---|---|
| 阶段 0 · 打地基 | 4 | ✅ 已上线(46 章 / 157 小节) |
| 阶段 1 · 会测 | 4 | ✅ 已上线(52 章 / 233 小节) |
| 阶段 2 · 自动化 | 5 | ⏳ 筹备中 |
| 阶段 2 · 自动化 | 6 | 🚧 部分上线(2 / 6) |
| 阶段 3 · 造工具 | 4 | ⏳ 筹备中 |
| 阶段 4 · 提效率 | 4 | ⏳ 筹备中 |
| 阶段 4 · 提效率 | 5 | ⏳ 筹备中 |
| 阶段 5 · 攻难点 | 5 | ⏳ 筹备中 |
| 阶段 6 · 成熟 | 4 | ⏳ 筹备中 |
@@ -33,6 +33,13 @@
| `modules/s1-03-web-frontend/` | Web 前端基础与调试 | 13 | 58 |
| `modules/s1-04-defect-process/` | 缺陷管理与测试流程 | 13 | 58 |
阶段 2 已上线的模块(共 6 个,其余 4 个筹备中):
| 目录 | 模块 | 章节 | 小节 |
|---|---|---|---|
| `modules/s2-01-go-test/` | Go 单元测试与 go test 工具链 | 13 | 60 |
| `modules/s2-02-go-project-test/` | Go 项目测试实战:替身、集成与基准 | 13 | 60 |
## 目录结构
```
@@ -48,8 +55,8 @@ testdev-learning-path/
│ │ ├── 01-why.html 第 1 章
│ │ └── … 章节页按 NN-英文名.html 命名,顺序即章号
│ ├── s0-02-golang/ … s0-04-database/ 阶段 0 的其余模块,结构同上
│ ├── s1-01-case-design/ … s1-02-http-api/ 阶段 1 的模块 1、2
│ └── s1-03-web-frontend/ … s1-04-defect-process/ 阶段 1 的模块 3、4(阶段 2 及以后尚未建目录)
│ ├── s1-01-case-design/ … s1-04-defect-process/ 阶段 1 的 4 个模块
│ └── s2-01-go-test/ … s2-02-go-project-test/ 阶段 2 的模块 1、2(其余 4 个模块尚未建目录)
└── tools/
├── modules-plan.json 模块级元数据(按阶段组织:标题、副标题、建议投入、导语)
├── glossary.json 术语表:统一的服务名 / 表名 / 状态取值 / Go 模块路径

View File

@@ -1022,7 +1022,10 @@ const PAGES = {
"s1-0": "modules/s1-01-case-design/index.html",
"s1-1": "modules/s1-02-http-api/index.html",
"s1-2": "modules/s1-03-web-frontend/index.html",
"s1-3": "modules/s1-04-defect-process/index.html"
"s1-3": "modules/s1-04-defect-process/index.html",
/* 阶段 2 · 自动化(6 个模块,前 2 个已上线) */
"s2-0": "modules/s2-01-go-test/index.html",
"s2-1": "modules/s2-02-go-project-test/index.html"
};
/* ============================ 工具 ============================ */

View File

@@ -169,7 +169,7 @@
<nav class="pager">
<a class="prev" href="../s1-03-web-frontend/index.html"><span class="k">← 上一模块</span><span class="v">Web 前端基础与调试</span></a>
<a class="next" href="../../index.html#s2"><span class="k">阶段 2 · 自动化 →</span><span class="v">回到学习路径,进入阶段 2 · 自动化</span></a>
<a class="next" href="../s2-01-go-test/index.html"><span class="k">阶段 2 · 自动化 →</span><span class="v">Go 单元测试与 go test 工具链</span></a>
</nav>
<p class="foot">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -96,7 +96,57 @@
/* 下面几个阶段目前只作为占位登记标题:modules 为空数组时生成器不会产出任何页面,
它们的作用是让「上一 / 下一模块」的衔接能指向正确的下一阶段(例如阶段 1 的最后一个
模块会指向「阶段 2 · 自动化」)。开始写某个阶段时,把它的 modules 数组填上即可。 */
{ "id": "s2", "num": "2", "title": "自动化", "sub": "go test · 接口框架 · UI 自动化 · 框架工程化", "anchorText": "阶段 2 · 自动化", "modules": [] },
{
"id": "s2",
"num": "2",
"title": "自动化",
"sub": "go test · 项目测试实战 · 接口框架 · UI 与移动端 · 框架工程化",
"anchorText": "阶段 2 · 自动化",
"modules": [
{
"dir": "s2-01-go-test",
"title": "Go 单元测试与 go test 工具链",
"sub": "测试组织 · 表驱动 · 断言 · 生命周期 · 替身 · 覆盖率与竞态",
"hours": "建议投入 26–34 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 1 个模块,也是整条自动化路线的地基。接口框架、平台后端、性能脚本最终都要落到「这段代码测得住吗」上,而回答这个问题只有一种方式:用 <code>go test</code> 写出别人敢改的测试。<br><br><b>学完之后你应该能:</b>给任意一个 Go 包补齐表驱动单测,用 <code>t.Run</code> 定位失败用例、用接口替身切掉数据库与第三方依赖,跑出 <code>-race</code> 无告警、覆盖率 ≥ 80% 的可重复结果;能说清哪些测试不该写、覆盖率什么时候会骗人。<br><br><b>学习方式:</b>不要新建练习仓库,找一个你身边的真实 Go 包,从第 2 章一路补到第 11 章。测试代码和业务代码一样要提交、要评审,否则它只是你本机的一次性脚本。"
},
{
"dir": "s2-02-go-project-test",
"title": "Go 项目测试实战:替身、集成与基准",
"sub": "测试布局 · HTTP 层 · sqlmock · testcontainers · 基准与 pprof",
"hours": "建议投入 28–36 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 2 个模块。上一个模块解决「一个函数怎么测」,这一个模块解决「一个服务怎么测」:handler、中间件、SQL、Redis、下游 HTTP 全都在真实项目里互相咬着,单测覆盖不到的那一层,正是缺陷最集中的地方。<br><br><b>学完之后你应该能:</b>用 <code>httptest</code> 覆盖路由、中间件与错误码而不起真服务;用 <code>go-sqlmock</code> 断言 SQL 与事务、用 <code>testcontainers-go</code> 起真实 MySQL 与 Redis 做集成测试并自动回收;用 build tag 与 <code>-short</code> 把慢测试和快测试分开;用 <code>Benchmark</code> 与 <code>benchstat</code> 说清一次优化到底快了多少、少分配了多少次。<br><br><b>学习方式:</b>每个小节都要求「一条命令跑起来」:单测 <code>go test ./... -short</code>、集成测试 <code>go test -tags=integration</code>、基准 <code>go test -bench . -benchmem</code>。测不起来的方案不算学会。"
},
{
"dir": "s2-03-api-framework",
"title": "接口自动化测试框架",
"sub": "分层设计 · Go 请求与断言 · 数据管理 · 报告与推送",
"hours": "建议投入 32–42 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 3 个模块,也是这一阶段的第一个大交付物。<br><br><b>学完之后你应该能:</b>用 Go 从零写出一个接口自动化框架:用例层、业务封装层与基础层职责分明,换一个环境只改配置不改代码。<br><br><b>学习方式:</b>边写边被真实用例折磨,框架的每个设计决定都要能回答「它替我解决了哪个重复劳动」。"
},
{
"dir": "s2-04-ui-automation",
"title": "UI 自动化:Playwright 与 Selenium",
"sub": "元素定位 · 等待机制 · PO 模式 · 稳定性治理",
"hours": "建议投入 24–32 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 4 个模块。UI 自动化是性价比争议最大的一层,学它的目的不是追求覆盖率,而是知道它在哪一段划得来、怎么让它连续跑十天不红。<br><br><b>学完之后你应该能:</b>用 Playwright 写出带自动等待、失败录屏与 trace 的冒烟用例,并能对每次失败给出归因。<br><br><b>学习方式:</b>先把定位与等待这两件事做对,再谈框架。选择器散落在用例里,写多少条都会烂掉。"
},
{
"dir": "s2-05-mobile-automation",
"title": "移动端与小程序自动化",
"sub": "机型矩阵 · Appium · 小程序与 WebView · 弱网与稳定性",
"hours": "建议投入 18–26 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 5 个模块,进阶选学。<br><br><b>学完之后你应该能:</b>说清移动端自动化与 Web 自动化的本质差别,搭起一套能在云真机上跑的启动、登录与核心页面冒烟用例。<br><br><b>学习方式:</b>没有真机就用模拟器起步,但机型选择必须拿用户占比和崩溃率说话,而不是凭手感挑。"
},
{
"dir": "s2-06-framework-eng",
"title": "自动化框架设计与工程化",
"sub": "分层解耦 · 配置与密钥 · 日志留痕 · 交付形态",
"hours": "建议投入 20–28 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 6 个模块,也是这一阶段的收口:把前五个模块散落的脚本,重构成一套新同事 30 分钟能跑通的框架。<br><br><b>学完之后你应该能:</b>说清框架与脚本的四点区别(可配置、可扩展、可观测、可维护),完成一次真实的重构与 README 交付。<br><br><b>学习方式:</b>用「新同事需不需要问你」当唯一验收标准。需要问你的地方,就是框架还缺的那一层。"
}
]
},
{ "id": "s3", "num": "3", "title": "造工具", "sub": "平台架构 · Go 后端 · 前端可视化 · Mock 与造数", "anchorText": "阶段 3 · 造工具", "modules": [] },
{ "id": "s4", "num": "4", "title": "提效率", "sub": "CI/CD 卡点 · 容器化 · 覆盖率 · 质量门禁", "anchorText": "阶段 4 · 提效率", "modules": [] },
{ "id": "s5", "num": "5", "title": "攻难点", "sub": "性能 · 稳定性 · 安全 · 兼容与弱网 · 数据与大模型", "anchorText": "阶段 5 · 攻难点", "modules": [] },