← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3228

录制桩要防漂移与泄露

理解等级:高级

无法从契约生成桩时,可录制真实交互,再用请求匹配与固定响应构建本地桩。录制比手写更接近当时接口,但它只是时间点快照,依赖变化后可能继续假通过;还要清理生产录制中的个人信息,避免把敏感数据保存到映射文件。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      Recording calls to APIs will produce more accurate stubs than that of hand rolling a stub. If you do use recordings, then you need to make sure they stay updated and in sync; also, if you make recordings against production, you need to watch that no PII is saved into the mapping files.

    参考来源

    - 位置:《Mastering API Architecture》第2章《Testing APIs》之《Using Stub Servers: Why and How》(源文件:_epub-src/OEBPS/ch02.xhtml) - 结论依据:原文比较手写与录制桩,说明录制可减少 URL/字段误写,同时明确要求持续同步并避免生产录制的 PII 落入映射文件。 - 原始内容:Recording calls to APIs will produce more accurate stubs than that of hand rolling a stub. If you do use recordings, then you need to make sure they stay updated and in sync; also, if you make recordings against production, you need to watch that no PII is saved into the mapping files.