Spy 对比 Stub
单选题 中等
题目
什么是 键 difference 之间 spy and stub?
提示
One watches, other replaces.
解释
spy wraps 真实函数 and 记录如何它 是 called (实参, 返回值, call 数量) 虽然 still 允许原始到 运行. stub replaces 函数完全 and 返回 preset 值不使用执行原始. Spies 是 for verification; stubs 是 for controlling behavior.
相关资源
相关课程
- Stubs and Spies
理解测试 doubles.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。