测试策略定义了项目如何确保质量——测试什么、在哪些级别、测试多少、使用什么工具和流程。好的策略在彻底性和成本之间取得平衡,将测试工作集中在提供最大价值的地方。
测试策略的要素
text
✓ WHAT to test → critical functionality, risky/complex areas, core business logic
(prioritize by RISK and value — you can't test everything)
✓ LEVELS → the test pyramid: many unit, some integration, few E2E (balance coverage/cost)
✓ TYPES → functional + non-functional (performance, security) as needed
✓ TOOLS/frameworks → appropriate for the stack; CI integration
✓ PROCESS → when tests run (CI on every change), coverage expectations, who owns tests
✓ AUTOMATION vs manual → automate regression/repetitive; manual for exploratory/usability
基于风险的优先级排序
text
You can't test EVERYTHING exhaustively → focus where it MATTERS most:
→ high-RISK areas (payment, auth, data integrity, complex logic) → test thoroughly
→ high-CHANGE areas → good tests (safety net for frequent changes)
→ low-risk/stable/trivial → lighter testing
→ Invest testing effort proportional to risk and value (not uniform coverage).
