知识卡片
真实依赖不替代契约
用真实依赖做集成测试能发现连接与协议问题,却不能自动替代消费者与生产者共同约定的契约。契约还承担交互定义、变更协商、生成验证和并行开发的作用。测试设计应分别说明“依赖能连通”和“双方承诺的行为稳定”,避免因为真实容器可运行就取消契约治理。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Testcontainers and integrating with a real service is a real boon and can add a lot of value to your testing, though they are not a replacement for contracts just because you can use a real version of a service. Working with a real instance is nice; however, contracts provide so much more than just a stub server—they provide all the testing, integration, and collaboration.
参考来源
- 位置:《Mastering API Architecture》第2章《Testing APIs》之《Case Study: Applying Testcontainers to Verify Integrations》(源文件:_epub-src/OEBPS/ch02.xhtml)
- 结论依据:原文明确指出真实服务测试不等同于端到端,Testcontainers 也不因能运行真实依赖就取代契约;后者还提供测试和协作机制。
- 原始内容:Testcontainers and integrating with a real service is a real boon and can add a lot of value to your testing, though they are not a replacement for contracts just because you can use a real version of a service. Working with a real instance is nice; however, contracts provide so much more than just a stub server—they provide all the testing, integration, and collaboration.