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

- 新增 modules/s2-03-api-framework(接口自动化测试框架,13 章 / 60 小节)
- 新增 modules/s2-04-ui-automation(UI 自动化:Playwright 与 Selenium,13 章 / 60 小节)
- index.html 的 PAGES 登记 s2-2 / s2-3;modules-plan.json 完善这两个模块的导语
- 工具链修正:链接检查跳过 pre 内部(代码块里的 href 文本是被讲的文本,不是死链)
- 工具链修正:模块目录页「约 N 千字」改为只数正文(剥掉侧栏目录树与代码块),全站口径统一
- README 更新进度表、阶段 2 模块表与目录结构
- 自检:check-chapter --strict 26 页通过、check-pages 163 页通过、check-glossary 162 页无漂移、portal 注册表通过
This commit is contained in:
2026-10-16 15:38:20 +08:00
parent 100f235e3f
commit 327b080b02
44 changed files with 14642 additions and 24 deletions

View File

@@ -9,7 +9,7 @@
|---|---|---|
| 阶段 0 · 打地基 | 4 | ✅ 已上线(46 章 / 157 小节) |
| 阶段 1 · 会测 | 4 | ✅ 已上线(52 章 / 233 小节) |
| 阶段 2 · 自动化 | 6 | 🚧 部分上线(2 / 6) |
| 阶段 2 · 自动化 | 6 | 🚧 部分上线(4 / 6) |
| 阶段 3 · 造工具 | 4 | ⏳ 筹备中 |
| 阶段 4 · 提效率 | 5 | ⏳ 筹备中 |
| 阶段 5 · 攻难点 | 5 | ⏳ 筹备中 |
@@ -33,12 +33,14 @@
| `modules/s1-03-web-frontend/` | Web 前端基础与调试 | 13 | 58 |
| `modules/s1-04-defect-process/` | 缺陷管理与测试流程 | 13 | 58 |
阶段 2 已上线的模块(共 6 个,其余 4 个筹备中):
阶段 2 已上线的模块(共 6 个,其余 2 个筹备中):
| 目录 | 模块 | 章节 | 小节 |
|---|---|---|---|
| `modules/s2-01-go-test/` | Go 单元测试与 go test 工具链 | 13 | 60 |
| `modules/s2-02-go-project-test/` | Go 项目测试实战:替身、集成与基准 | 13 | 60 |
| `modules/s2-03-api-framework/` | 接口自动化测试框架 | 13 | 60 |
| `modules/s2-04-ui-automation/` | UI 自动化:Playwright 与 Selenium | 13 | 60 |
## 目录结构
@@ -56,7 +58,7 @@ testdev-learning-path/
│ │ └── … 章节页按 NN-英文名.html 命名,顺序即章号
│ ├── s0-02-golang/ … s0-04-database/ 阶段 0 的其余模块,结构同上
│ ├── s1-01-case-design/ … s1-04-defect-process/ 阶段 1 的 4 个模块
│ └── s2-01-go-test/ … s2-02-go-project-test/ 阶段 2 的模块 1、2(其余 4 个模块尚未建目录)
│ └── s2-01-go-test/ … s2-04-ui-automation/ 阶段 2 的模块 1–4(其余 2 个模块尚未建目录)
└── tools/
├── modules-plan.json 模块级元数据(按阶段组织:标题、副标题、建议投入、导语)
├── glossary.json 术语表:统一的服务名 / 表名 / 状态取值 / Go 模块路径
@@ -85,7 +87,8 @@ node tools/check-glossary.js # 4. 命名一致性自检,退出码非 0
其余四个工具都是幂等的,可以反复执行。`check-pages.js` 覆盖:
- 站内链接是否存在、页内锚点是否可达(含 `#s0` 这类由 JS 生成的阶段锚点)
- 站内链接是否存在、页内锚点是否可达(含 `#s0` 这类由 JS 生成的阶段锚点;
链接扫描会跳过 `<pre>` 内部,代码块里的 `href="/cart"` 属于「被讲的文本」,不算链接)
- 标签配对、每页 `<title>`、`<article>`
- 章节页必须有的定位条 `.chapnav`、上下章 `.pager`、返回模块目录、`#chapters` 侧栏
- 每个 `<pre>` 必须标 `data-lang`,且内部 `<` 必须转义成 `&lt;`

View File

@@ -1023,9 +1023,11 @@ const PAGES = {
"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",
/* 阶段 2 · 自动化(6 个模块,前 2 个已上线) */
/* 阶段 2 · 自动化(6 个模块,前 4 个已上线) */
"s2-0": "modules/s2-01-go-test/index.html",
"s2-1": "modules/s2-02-go-project-test/index.html"
"s2-1": "modules/s2-02-go-project-test/index.html",
"s2-2": "modules/s2-03-api-framework/index.html",
"s2-3": "modules/s2-04-ui-automation/index.html"
};
/* ============================ 工具 ============================ */

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>11</b> 章</span>
<span><b>38</b> 个小节</span>
<span>约 <b>54</b> 千字</span>
<span>约 <b>44</b> 千字</span>
<span>建议投入 18–24 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>45</b> 个小节</span>
<span>约 <b>67</b> 千字</span>
<span>约 <b>54</b> 千字</span>
<span>建议投入 30–40 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>11</b> 章</span>
<span><b>37</b> 个小节</span>
<span>约 <b>57</b> 千字</span>
<span>约 <b>46</b> 千字</span>
<span>建议投入 20–28 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>11</b> 章</span>
<span><b>37</b> 个小节</span>
<span>约 <b>58</b> 千字</span>
<span>约 <b>48</b> 千字</span>
<span>建议投入 20–26 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>59</b> 个小节</span>
<span>约 <b>81</b> 千字</span>
<span>约 <b>61</b> 千字</span>
<span>建议投入 22–28 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>58</b> 个小节</span>
<span>约 <b>78</b> 千字</span>
<span>约 <b>62</b> 千字</span>
<span>建议投入 24–30 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>58</b> 个小节</span>
<span>约 <b>86</b> 千字</span>
<span>约 <b>68</b> 千字</span>
<span>建议投入 18–24 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>58</b> 个小节</span>
<span>约 <b>89</b> 千字</span>
<span>约 <b>67</b> 千字</span>
<span>建议投入 16–22 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>60</b> 个小节</span>
<span>约 <b>70</b> 千字</span>
<span>约 <b>61</b> 千字</span>
<span>建议投入 26–34 小时</span>
</div>
</div>

View File

@@ -43,7 +43,7 @@
<div class="mh-meta">
<span>共 <b>13</b> 章</span>
<span><b>60</b> 个小节</span>
<span>约 <b>70</b> 千字</span>
<span>约 <b>60</b> 千字</span>
<span>建议投入 28–36 小时</span>
</div>
</div>
@@ -169,7 +169,7 @@
<nav class="pager">
<a class="prev" href="../s2-01-go-test/index.html"><span class="k">← 上一模块</span><span class="v">Go 单元测试与 go test 工具链</span></a>
<a class="next" href="../../index.html#s2"><span class="k">下一模块 →</span><span class="v">筹备中:接口自动化测试框架</span></a>
<a class="next" href="../s2-03-api-framework/index.html"><span class="k">下一模块 →</span><span class="v">接口自动化测试框架</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

@@ -64,8 +64,13 @@ stages.forEach((st, si) => {
const title = plain(h2[1].replace(/<span class="n">\d+<\/span>/, ""));
const sections = [...html.matchAll(/<h3 id="([^"]+)">([\s\S]*?)<\/h3>/g)]
.map(x => ({ id: x[1], label: stripNo(plain(x[2])) }));
// 字数口径:只统计中文汉字(代码与英文命令不计入「千字」,否则会被严重高估)
const chars = (stripTags(html).match(/[\u4e00-\u9fff]/g) || []).length;
// 字数口径:只统计中文汉字(代码与英文命令不计入「千字」,否则会被严重高估);
// 侧栏目录树(build-nav.js 写入的整本书目录)与代码块(含中文注释)都不属于正文,先剥掉再数
const prose = html
.replace(/<script[\s\S]*?<\/script>/g, "")
.replace(/<nav id="chapters">[\s\S]*?<\/nav>/g, "")
.replace(/<pre[\s\S]*?<\/pre>/g, "");
const chars = (stripTags(prose).match(/[\u4e00-\u9fff]/g) || []).length;
return { file, title, sections, chars };
});
}

View File

@@ -162,8 +162,9 @@ for (const p of files) {
// 残留占位
if (/<!--\s*(MORE|TODO|PART\d|占位)/i.test(html)) problems.push(`${rel}: 有未完成的占位注释`);
// 链接与锚点
const links = [...markup.matchAll(/href="(?!https?:|mailto:)([^"]+)"/g)].map(m => m[1]);
// 链接与锚点(排除 <pre> 内部:代码块里的 href="/cart" 是「被讲的文本」,不是真链接)
const linkScope = markup.replace(/<pre[\s\S]*?<\/pre>/g, "");
const links = [...linkScope.matchAll(/href="(?!https?:|mailto:)([^"]+)"/g)].map(m => m[1]);
for (const l of new Set(links)) {
const [file, hash] = l.split("#");
const target = file ? path.resolve(path.dirname(p), file) : path.resolve(p);

View File

@@ -86,7 +86,9 @@ for (const p of pages) {
if (o !== c) problems.push(`${rel}: <${t}> 开合不匹配 ${o}/${c}`);
}
const links = [...markup.matchAll(/href="(?!https?:|mailto:)([^"]+)"/g)].map(m => m[1]);
// 链接扫描要排除 <pre> 内部:代码块里的 href="/cart" 是「被讲的文本」,不是真链接
const linkScope = markup.replace(/<pre[\s\S]*?<\/pre>/g, "");
const links = [...linkScope.matchAll(/href="(?!https?:|mailto:)([^"]+)"/g)].map(m => m[1]);
for (const l of new Set(links)) {
const [file, hash] = l.split("#");
const target = file ? path.resolve(path.dirname(p), file) : path.resolve(p);

View File

@@ -122,14 +122,14 @@
"title": "接口自动化测试框架",
"sub": "分层设计 · Go 请求与断言 · 数据管理 · 报告与推送",
"hours": "建议投入 32–42 小时",
"lead": "<b>模块定位:</b>阶段 2 的第 3 个模块,也是这一阶段的第一个大交付物。<br><br><b>学完之后你应该能:</b>用 Go 从零写出一个接口自动化框架:用例层、业务封装层与基础层职责分明,换一个环境只改配置不改代码。<br><br><b>学习方式:</b>边写边被真实用例折磨,框架的每个设计决定都要能回答「它替我解决了哪个重复劳动」。"
"lead": "<b>模块定位:</b>阶段 2 的第 3 个模块,也是这一阶段的第一个大交付物。手工接口用例只能证明「这一次是对的」,只有跑得起来、看得懂、维护得住的框架,才能把它变成「每一次都是对的」。<br><br><b>学完之后你应该能:</b>用 Go 从零写出一个接口自动化框架:基础层(请求、配置、日志、断言)、业务封装层(API Object)、用例层职责分明;换一个环境只改配置不改代码;一轮 3 分钟内出报告、失败原因一眼可见;并留出接手 Python 存量脚本(requests 加 pytest)的适配入口。<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>先把定位与等待这两件事做对,再谈框架。选择器散落在用例里,写多少条都会烂掉。"
"lead": "<b>模块定位:</b>阶段 2 的第 4 个模块,也是性价比争议最大的一层。UI 自动化的失败几乎都来自两件事:定位写歪了、等待写错了。学它的目的不是追求覆盖率,而是知道它在哪一段划得来、怎么让它连续跑十天不红。<br><br><b>学完之后你应该能:</b>用 Playwright 写出带自动等待、页面对象与失败录屏 / trace 的核心链路冒烟用例,并对每一次失败给出归因(真缺陷 / 环境问题 / 用例自身);能说清哪些用例值得上 UI 自动化、哪些必须留在人工。<br><br><b>学习方式:</b>先把定位与等待这两件事做对,再谈框架。选择器散落在用例里,写多少条都会烂掉;先跟开发谈成 data-testid 约定,再动手写第一个页面对象。"
},
{
"dir": "s2-05-mobile-automation",