.net 的首选单元测试隔离框架

发布于 2024-07-30 19:27:37 字数 274 浏览 2 评论 0原文

我已经使用 RhinoMocks 产品一段时间了,并且对该产品非常满意 -从来没有理由真正去别处寻找。 最近,TypeMock 的好人要求我尝试一下他们的产品,并想知道其他开发人员的意见是什么关于 Typemock 隔离器。 您还建议其他任何隔离/模拟框架吗?为什么?

I have used the RhinoMocks product for quite some time and have been quite happy with the product - never had a reason to look elsewhere really. I was recently asked by the good folks at TypeMock to give their product a whirl and was wondering what other developers opinions are about Typemock Isolator. Are there any other isolation/mocking frameworks that you would suggest and why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如痴如狂 2024-08-06 19:27:37

就我个人而言,我使用 RhinoMocks,并且我对这个模拟框架非常满意,特别是因为他们使用 lambda 语法实现了 AAA 模式。

我从未使用过 Typemock,但我读到这个框架非常强大,可以模拟几乎所有东西。 有些人认为这不是一件好事,因为它不会强迫开发人员设计他的类以实现可测试性。 就我个人而言,我认为当您有遗留代码需要测试并且没有时间和资源来重构它时,TypeMock 会非常有用。

其他框架:

Moq

NMock

Personnally, I use RhinoMocks and I'm pretty satisfied with this mock framework especially since they implemented the AAA pattern with lambda syntax.

I never used Typemock but I read that this framework is very powerful and can mock almost everything. Some person thinks that it is not a good thing since it does not force the developer to design his classes for testability. Personnally, I think TypeMock can be very useful when you have legacy code to test and you do not have the time and resource to refactor it.

Other frameworks:

Moq

NMock

无妨# 2024-08-06 19:27:37

Moq是我最近一直在使用的。 非常值得一看; 我特别喜欢 lambda 语法。 我以非常简洁但可读的方式取得了很大的成就。

起订量

Moq is what I have been using recently. It is well worth a look; I especially like the lambda syntax. I achieve a great deal in a very terse yet readable manner.

Moq

原野 2024-08-06 19:27:37

我已经使用 TypeMock 一年多了,如果没有它我就无法完成一个项目。 我听到很多人说TypeMock太强大了,那又如何呢? 拥有所有这些功能并不会让我设计出糟糕的代码。

我已经搞乱了其他模拟框架,但我喜欢 TypeMock 的是它几乎可以模拟任何东西,而无需我到处创建接口,因为某些模拟框架只能模拟接口,而不是实际对象。 我目前在 SharePoint 上开发代码的工作突出了这一点。 如果没有 TypeMock,我就无法编写好的单元测试。 我看不到 Moq 或 RhinoMocks 允许我模拟 SharePoint 对象模型代码。 如果我在这一点上错了,请纠正我。

TypeMock 的另一个优点是来自公司的支持。 他们的开发人员总是活跃在公司的论坛上,因此如果您确实遇到问题,他们可以快速帮助您解决。 这种帮助可以是回答您可能发布的论坛问题,也可以是通过电子邮件实际与您联系(如果您的问题比论坛答案更复杂)。

TypeMock 的一个症结在于成本,它不是一种便宜的产品。 然而,它为我节省了测试时间(以及我编写测试的灵活性),使其成为值得购买的产品。

I've used TypeMock for over a year and there is no way I'd work on a project without it. I hear a lot of people saying that TypeMock is too powerful, well so what if it is? Having all that power does not make me design my code poorly.

I've messed about with other mocking frameworks, but what I like about TypeMock is that it can mock almost anything, without me having to create interfaces all over the place, since some mocking frameworks can only mock an interface, rather then the actual object. This is highlighted with my current work which is developing code on SharePoint. Without TypeMock, there is no way I could write good unit tests. I can't see Moq or RhinoMocks allowing me to mock out SharePoint object model code. Correct me if I'm wrong on that one.

Another great plus with TypeMock is the support from the company. Their developers are always active on the company's forums, so if you do have an issue then they can quickly help you out. This help can come in either answering a forum question you may have posted, or actually contacting you via email if your problem is more involved then a forum answer could provide.

The one sticking point with TypeMock is cost, it's not a cheap product. However, the amount of time it's saved me in testing (and the flexibility I have in writing my tests) has made it a worthwhile purchase.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文