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

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
D
Docker
Vercel News
Vercel News
IT之家
IT之家
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
腾讯CDC
Google DeepMind News
Google DeepMind News
I
InfoQ
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
博客园 - Franky
The Cloudflare Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
T
Tenable Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Security Latest
Security Latest
H
Hackread – Cybersecurity News, Data Breaches, AI and More
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google Online Security Blog
Google Online Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
U
Unit 42
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
F
Full Disclosure
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
Project Zero
Project Zero

博客园 - 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可以为我们带来的最大好处——曾被称为接口识别的概念"。