测试软件:fake vs stub [英] Testing software: fake vs stub

查看:40
本文介绍了测试软件:fake vs stub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于存根与模拟的文章很多,但我看不出假和存根之间的真正区别.任何人都可以解释一下吗?

There are quite a few written about stub vs mocks, but I can't see the real difference between fake and stub. Can anyone put some light on it?

推荐答案

我假设您指的是 Meszaros 引入的术语.Martin Fowler 也会定期提及他们.我认为他在那篇文章中很好地解释了差异.

I assume you are referring to the terminology as introduced by Meszaros. Martin Fowler does also mentions them regularly. I think he explains the difference pretty well in that article.

尽管如此,我会用我自己的话再试一次:)

Nevertheless, I'll try again in my own words :)

Fake 比存根更接近真实世界的实现.存根基本上包含对预期请求的硬编码响应;它们通常用于单元测试,但它们无法处理预编程以外的输入.

A Fake is closer to a real-world implementation than a stub. Stubs contain basically hard-coded responses to an expected request; they are commonly used in unit tests, but they are incapable of handling input other than what was pre-programmed.

Fakes 有一个更真实的实现,比如可以保留的某种状态.它们可用于系统测试以及单元测试目的,但由于某些限制或质量要求,它们不适用于生产用途.

Fakes have a more real implementation, like some kind of state that may be kept for example. They can be useful for system tests as well as for unit testing purposes, but they aren't intended for production use because of some limitation or quality requirement.

这篇关于测试软件:fake vs stub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆