惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Troy Hunt's Blog
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
F
Full Disclosure
N
Netflix TechBlog - Medium
C
Check Point Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
H
Help Net Security
F
Fortinet All Blogs
P
Proofpoint News Feed
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Vercel News
Vercel News
A
About on SuperTechFans
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
B
Blog RSS Feed
S
Securelist
Y
Y Combinator Blog
C
Cybersecurity and Infrastructure Security Agency CISA
D
DataBreaches.Net
B
Blog
The Hacker News
The Hacker News
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
AWS News Blog
AWS News Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
C
Cisco Blogs

博客园 - Easy Company

如何取得显示实现方法的MethodInfo SQL Server 2008中许多兼容性上的问题 ThreadPool 在.Net 2.0 SP1中的部分变化可能会让你的程序停止工作 目前不能使用SQL Server 2008 CTP February 2008存储Team Foundation Server 2008的数据 Javascript操作在各浏览器下的性能比较 WCF Web 编程模型资源 代码行数引起的思考 在按钮点击后禁用它直到操作完成 - Easy Company - 博客园 ASP.NET 2.0中使用强类型访问PreviousPage属性页的控件 Silverlight 与 Microsoft ASP.NET Futures (July 2007) 更新 VS 2008 和.NET 3.5 Beta 2 安装注意事项 Partial Methods CIL(Common Intermediate Language)指令集 刚刚下载了 Visual Studio 2005 Service Pack 1 (SP1) 使用 Facade 设计模式管理 ASP.Net Session 变量 .Net 中的日志 使用 Membership 时获取用户的最后登录时间 How To 推荐用于 AJAX 页面的进度指示器图片
Mock 对象何时使用?
Easy Company · 2008-06-12 · via 博客园 - Easy Company

Colin Mackay讲述mock的论文 中列出了一些常见的使用mock的场景:

  • 真实对象有着不确定的行为
  • 真实对象很难创建
  • 真实对象的行为很难触发
  • 真实对象响应缓慢
  • 真实对象是用户界面
  • 真实对象使用了回调机制
  • 真实对象尚未存在

K Scott AllenMocks - It's A Question Of When 认为,即使是上面列表中的内容也稍显肤浅,从更深刻、更普遍的意义而言,应该是”在你想把被测试的代码分离的时候,martin fowlertest doubles[mocks]就显出了作用。“简而言之,按照Allen的观点,用了mock对象,业务组件的测试代码就可以不依赖其它组件了;试举一例来看,A依赖于B,但A的单元测试只会因为A的问题而出现问题,跟B的状态无干。

"Mock Roles, Not Objects" 的作者们写到,mock技术:
"……在基于对象角色构建的系统中,可以识别出各种角色类型……尤其是,我们已经知道了Mock Object可以为我们带来的最大好处——曾被称为接口识别的概念"。