知识卡片

普通读书笔记卡 · 6075.d.1

集成测试从公共接口验证

理解等级:中级

tests中的集成测试以独立crate链接被测库,只使用公共API,因此能验证外部调用者真正可用的行为。它补充内部单元测试:内部函数测试都成功,也不代表公共构造、导出与错误契约组合正确。公共帮助模块应按测试结构组织,避免误把辅助文件当独立测试。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 5. Tooling Integration Tests · 查看原书依据

      Integration Tests The other common form of test included with a Rust project is integration tests, held under tests/. Each file in that directory is run as a separate test program that executes all of the functions marked with #[test]. Integration tests do not have access to crate internals and so act as behavior tests that can exercise only the public API o

    参考来源

    - 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第5章《Integration Tests》(spine9;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch05.html;u153-ch05-023)。 - 结论依据:原文在“Integration Tests”附近的定义、例子或代码支撑本卡核心说明:tests中的集成测试以独立crate链接被测库,只使用公共API,因此能验证外部调用者真正可用的行为。边界按已读前提解释;示例未执行。 - 原始内容:Integration Tests The other common form of test included with a Rust project is integration tests, held under tests/. Each file in that directory is run as a separate test program that executes all of the functions marked with #[test]. Integration tests do not have access to crate internals and so act as behavior tests that can exercise only the public API o