Loading...
Loading...
Compare original and translation side by side
data/sources.jsonreferences/operational-playbook.mddata/sources.jsonreferences/operational-playbook.md| Need | Skill |
|---|---|
| Debug failing tests or incidents | qa-debugging |
| Test LLM agents/personas | qa-agent-testing |
| Perform security audit/threat model | software-security-appsec |
| Design CI/CD pipelines and infra | ops-devops-platform |
| 需求场景 | 对应技能 |
|---|---|
| 调试失败的测试或事件 | qa-debugging |
| 测试LLM Agent/角色 | qa-agent-testing |
| 执行安全审计/威胁建模 | software-security-appsec |
| 设计CI/CD流水线和基础设施 | ops-devops-platform |
| Test Type | Goal | Typical Use |
|---|---|---|
| Unit | Prove logic and invariants fast | Pure functions, core business rules |
| Component | Validate UI behavior in isolation | UI components and state transitions |
| Integration | Validate boundaries with real deps | API + DB, queues, external adapters |
| Contract | Prevent breaking changes cross-team | OpenAPI/AsyncAPI/JSON Schema/Protobuf |
| E2E | Validate critical user journeys | 1–2 “money paths” per product area |
| Performance | Enforce budgets and capacity | Load, stress, soak, regression trends |
| Visual | Catch UI regressions | Layout/visual diffs on stable pages |
| Accessibility | Automate WCAG checks | axe smoke + targeted manual audits |
| Security | Catch common web vulns early | DAST smoke + critical checks in CI |
| 测试类型 | 目标 | 典型场景 |
|---|---|---|
| 单元测试 | 快速验证逻辑和不变量 | 纯函数、核心业务规则 |
| 组件测试 | 隔离验证UI行为 | UI组件和状态转换 |
| 集成测试 | 验证与真实依赖的边界交互 | API+数据库、消息队列、外部适配器 |
| 契约测试 | 跨团队防止破坏性变更 | OpenAPI/AsyncAPI/JSON Schema/Protobuf |
| E2E测试 | 验证关键用户路径 | 每个产品域1-2条“核心业务路径” |
| 性能测试 | 执行预算和容量验证 | 负载、压力、稳定性、回归趋势测试 |
| 视觉测试 | 捕获UI回归问题 | 稳定页面的布局/视觉差异对比 |
| 可访问性测试 | 自动化WCAG合规检查 | axe工具快速扫描+针对性人工审计 |
| 安全测试 | 尽早发现常见Web漏洞 | DAST快速扫描+CI中执行关键检查 |
/\
/E2E\ 5-10% - Critical journeys
/------\
/Integr. \ 15-25% - API, DB, queues
/----------\
/Component \ 20-30% - UI modules
/------------\
/ Unit \ 40-60% - Logic and invariants
/--------------\ /\
/E2E\ 5-10% - 关键用户路径
/------\
/Integr. \ 15-25% - API、数据库、消息队列
/----------\
/Component \ 20-30% - UI模块
/------------\
/ Unit \ 40-60% - 逻辑和不变量
/--------------\Need to test: [Feature Type]
│
├─ Pure business logic/invariants? → Unit tests (mock boundaries)
│
├─ UI component/state transitions? → Component tests
│ └─ Cross-page user journey? → E2E tests
│
├─ API Endpoint?
│ ├─ Single service boundary? → Integration tests (real DB/deps)
│ └─ Cross-service compatibility? → Contract tests (schema/versioning)
│
├─ Event-driven/API schema evolution? → Contract + backward-compat tests
│
└─ Performance-critical? → k6 load testing需要测试:[功能类型]
│
├─ 纯业务逻辑/不变量?→ 单元测试(模拟依赖边界)
│
├─ UI组件/状态转换?→ 组件测试
│ └─ 跨页面用户路径?→ E2E测试
│
├─ API接口?
│ ├─ 单一服务边界?→ 集成测试(真实数据库/依赖)
│ └─ 跨服务兼容性?→ 契约测试(Schema/版本管理)
│
├─ 事件驱动/API Schema演进?→ 契约测试+向后兼容测试
│
└─ 性能关键型功能?→ k6负载测试| Budget | Target |
|---|---|
| PR gate | p50 ≤ 10 min, p95 ≤ 20 min |
| Mainline health | ≥ 99% green builds/day |
| 预算指标 | 目标值 |
|---|---|
| PR门禁 | p50 ≤ 10分钟,p95 ≤ 20分钟 |
| 主干分支健康度 | 每日构建成功率 ≥ 99% |
flaky_failures / total_test_executionsflaky_failure = fail_then_pass_on_rerun不稳定测试失败数 / 总测试执行数不稳定测试失败数it('should apply discount', () => {
// Arrange
const order = { total: 150 };
// Act
const result = calculateDiscount(order);
// Assert
expect(result.discount).toBe(15);
});it('should apply discount', () => {
// Arrange
const order = { total: 150 };
// Act
const result = calculateDiscount(order);
// Assert
expect(result.discount).toBe(15);
});class LoginPage {
async login(email: string, password: string) {
await this.page.fill('[data-testid="email"]', email);
await this.page.fill('[data-testid="password"]', password);
await this.page.click('[data-testid="submit"]');
}
}class LoginPage {
async login(email: string, password: string) {
await this.page.fill('[data-testid="email"]', email);
await this.page.fill('[data-testid="password"]', password);
await this.page.click('[data-testid="submit"]');
}
}| Anti-Pattern | Problem | Solution |
|---|---|---|
| Testing implementation | Breaks on refactor | Test behavior |
| Shared mutable state | Flaky tests | Isolate test data |
| sleep() in tests | Slow, unreliable | Use proper waits |
| Everything E2E | Slow, expensive | Use test pyramid |
| Ignoring flaky tests | False confidence | Fix or quarantine |
| 反模式 | 问题 | 解决方案 |
|---|---|---|
| 测试实现细节 | 重构时易失效 | 测试行为而非实现 |
| 共享可变状态 | 导致测试不稳定 | 隔离测试数据 |
| 测试中使用sleep() | 缓慢且不可靠 | 使用事件驱动的等待机制 |
| 所有测试都用E2E | 缓慢且成本高 | 遵循测试金字塔原则 |
| 忽略不稳定测试 | 导致虚假的信心 | 修复或隔离不稳定测试 |
| Resource | Purpose |
|---|---|
| comprehensive-testing-guide.md | End-to-end playbook across layers |
| operational-playbook.md | Testing pyramid, BDD, CI gates |
| shift-left-testing.md | Contract-first, BDD, continuous testing |
| test-automation-patterns.md | Reliable patterns and anti-patterns |
| playwright-webapp-testing.md | Playwright patterns |
| chaos-resilience-testing.md | Chaos engineering |
| observability-driven-testing.md | OpenTelemetry, trace-based |
| contract-testing-2026.md | Pact, Specmatic |
| synthetic-test-data.md | Privacy-safe, ephemeral test data |
| 资源 | 用途 |
|---|---|
| comprehensive-testing-guide.md | 跨测试层级的完整操作手册 |
| operational-playbook.md | 测试金字塔、BDD、CI门禁 |
| shift-left-testing.md | 契约优先、BDD、持续测试 |
| test-automation-patterns.md | 可靠模式与反模式 |
| playwright-webapp-testing.md | Playwright使用模式 |
| chaos-resilience-testing.md | 混沌工程 |
| observability-driven-testing.md | OpenTelemetry、基于链路追踪的测试 |
| contract-testing-2026.md | Pact、Specmatic契约测试 |
| synthetic-test-data.md | 隐私安全的临时测试数据 |
| Template | Purpose |
|---|---|
| template-test-case-design.md | Given/When/Then and test oracles |
| test-strategy-template.md | Risk-based strategy |
| template-flaky-test-triage.md | Flake triage runbook |
| template-jest-vitest.md | Unit test patterns |
| template-api-integration.md | API + DB integration tests |
| template-playwright.md | Playwright E2E |
| template-visual-testing.md | Visual regression testing |
| template-k6-load-testing.md | k6 performance |
| automation-pipeline-template.md | CI stages, budgets, gates |
| template-cucumber-gherkin.md | BDD feature files and steps |
| 模板 | 用途 |
|---|---|
| template-test-case-design.md | Given/When/Then测试用例设计和测试断言 |
| test-strategy-template.md | 基于风险的测试策略模板 |
| template-flaky-test-triage.md | 不稳定测试排查手册模板 |
| template-jest-vitest.md | 单元测试模式模板 |
| template-api-integration.md | API+数据库集成测试模板 |
| template-playwright.md | Playwright E2E测试模板 |
| template-visual-testing.md | 视觉回归测试模板 |
| template-k6-load-testing.md | k6性能测试模板 |
| automation-pipeline-template.md | CI阶段、预算、门禁模板 |
| template-cucumber-gherkin.md | BDD特性文件和步骤模板 |
| File | Purpose |
|---|---|
| sources.json | External references |
| 文件 | 用途 |
|---|---|
| sources.json | 外部参考链接集合 |