← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 623.a.1

测试替身切断依赖

理解等级:中级

测试替身用可控实现替代被测组件所需的依赖,使组件能隔离测试。与其只模拟整个 IaaS 平台,替换其他基础设施组件往往更有价值,可降低慢、贵、不稳定或共享数据导致的干扰。隔离测试之后仍需真实集成;替身是解耦手段,不是删去契约的理由。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 基础设施代码测试策略 · 查看原书依据

      A useful technique for addressing this is to replace dependencies with test doubles. A test double replaces a dependency needed by a component so you can test it in isolation. Mocks, fakes, and stubs are types of test doubles. These terms tend to be used

    参考来源

    - 位置:《Infrastructure As Code》第17章《基础设施代码测试策略》(来源项目:book-sources;源文件:extracted/Infrastructure As Code/_epub-src/OEBPS/ch17.html) - 结论依据:原文在该段定义概念并解释相关过程或限制,支撑“测试替身用可控实现替代被测组件所需的依赖,使组件能隔离测试”这一核心结论;正文的用途与边界据同小节后续论述整理。 - 原始内容:A useful technique for addressing this is to replace dependencies with test doubles. A test double replaces a dependency needed by a component so you can test it in isolation. Mocks, fakes, and stubs are types of test doubles. These terms tend to be used