知识卡片
契约测试纳入持续集成
把 API 实现与文档契约的自动化比对放进持续集成,可在发布前发现请求或响应偏离规范的变更。契约测试应与应用单元测试配合;通过测试能提高信心,却不能保证真实客户端与服务端集成必定成功。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 1 章《What are microservice APIs?》(源文件:_epub-src/OEBPS/Text/01.htm)
- 结论依据:1.4 节建议把根据 API 文档生成的测试和单元测试一同放进 CI,以避免发布破坏文档契约的代码;随后明确文档驱动开发不能提供百分之百的集成保证。
- 原始内容:You should run these tests in your continuous integration server to make sure you don’t release any code that breaks the contract with the API documentation. ... Although documentation-driven development won’t give a 100% guarantee that your API integrations will work, it will significantly reduce the risk of API integration failure.