testing-strategy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Testing Strategy

测试策略

Design effective testing strategies balancing coverage, speed, and maintenance.
设计兼顾测试覆盖范围、执行速度与维护成本的有效测试策略。

Testing Pyramid

测试金字塔

        /  E2E  \         Few, slow, high confidence
       / Integration \     Some, medium speed
      /    Unit Tests  \   Many, fast, focused
        /  E2E  \         数量少、速度慢、可信度高
       / Integration \     数量中等、速度适中
      /    Unit Tests  \   数量多、速度快、聚焦性强

Strategy by Component Type

按组件类型制定策略

  • API endpoints: Unit tests for business logic, integration tests for HTTP layer, contract tests for consumers
  • Data pipelines: Input validation, transformation correctness, idempotency tests
  • Frontend: Component tests, interaction tests, visual regression, accessibility
  • Infrastructure: Smoke tests, chaos engineering, load tests
  • API endpoints:针对业务逻辑的单元测试、针对HTTP层的集成测试、针对消费者的契约测试
  • 数据管道:输入验证、转换正确性测试、幂等性测试
  • 前端:组件测试、交互测试、视觉回归测试、可访问性测试
  • 基础设施:冒烟测试、混沌工程、负载测试

What to Cover

测试覆盖重点

Focus on: business-critical paths, error handling, edge cases, security boundaries, data integrity.
Skip: trivial getters/setters, framework code, one-off scripts.
聚焦于:业务关键路径、错误处理、边缘情况、安全边界、数据完整性。
可忽略:简单的getter/setter方法、框架代码、一次性脚本。

Output

输出成果

Produce a test plan with: what to test, test type for each area, coverage targets, and example test cases. Identify gaps in existing coverage.
生成包含以下内容的测试计划:测试范围、各领域对应的测试类型、覆盖目标,以及示例测试用例。识别现有测试覆盖的缺口。