问题描述
几周前我开始了TDD.我必须在充满非虚拟方法的C#代码上进行单元测试,并且也没有太多接口.因此,在我研究了RhinoMock和Moq之后,代理解决方案还不够:我需要的是隔离器,这要归功于探查器.
I've started TDD some weeks ago. I have to do Unit Tests on a C# code full of non-virtual methods and there is no much interface either. Therefore, after I've been studying RhinoMock and Moq, a proxy solution wasn't enough: what I need is an isolation thanks to a profiler.
从我阅读的内容中,我有3种选择:
From what I read, I have 3 choices:
- TypeMock 隔离器,非常强大,但也非常昂贵
http://www.typemock.com/ Telerik的 - JustMock ,它是TypeMock的替代版本,其目标是TypeMock,但Beta版充满了错误.
http://www.telerik.com/products/mocking.aspx 来自Microsoft Pex的 - Moles ,这是唯一的隔离解决方案,但绝对不是模拟框架,请参阅此处
- TypeMock Isolator, very powerful but also very expensive
http://www.typemock.com/ - JustMock of Telerik, the alternative to TypeMock which aims to be TypeMock, but the beta was full of bugs
http://www.telerik.com/products/mocking.aspx - Moles from Microsoft Pex, the only free solution for isolation but definitively not a mocking-framework, see here
我需要易于配置的模拟. Moles不提供高级的声明式验证功能,因此我自己很难做到.
I need mocks easy to configure. Moles don't provide advanced declarative verification feature and it is a pain to do it myself.
TypeMock是一个很好的解决方案,但是对于我真正需要的东西肯定有点多,我发现价格太高了.
TypeMock is a good solution, but certainly a little to much for what I really need and I found the price too high.
JustMock应该进行一些并发,但是我没有找到很多参考.真可惜,它的语法接近 Moq ,并且应该是一个很好的过渡(例如,由于依赖注入,我可以使用更简洁的代码切换到免费版本).但是TypeMock于2006年推出,而Justmock在2010年仍为Beta版,但差距仍然很大(尽管Telerik表现出色). Q2修复错误于2010年7月发布.
JustMock should make some concurrence, but I don't found many references. It's a shame, its syntax is close to Moq and it should be a good transition (and I could switch to the free version with a cleaner code, thanks to dependency injection for example). But TypeMock was launched in 2006 while Justmock still was beta in 2010, there was a glaring gap (although Telerik has good marks). The Q2 fixing bugs was released in July 2010.
问题:JustMock的最新版本是否足够有效?他们是一些满意的用户吗?
Question: Does the last version of JustMock is enough effective? Are they some satisfied users?
(仅针对接口/代理/非虚拟方法的良好免费参考:)
参见 http://www.ayende.com/projects/rhino-mocks.aspx
参见 http://code.google.com/p/moq/
参见 http://www.nmock.org/
(good free references ONLY for interface/delegates/non-virtual methods:)
see http://www.ayende.com/projects/rhino-mocks.aspx
see http://code.google.com/p/moq/
see http://www.nmock.org/
推荐答案
[冗余全披露:我为Telerik工作.]
[Redundant Full-Disclosure: I work for Telerik.]
关注JustMock,我认为您会发现最新版本是功能非常强大的模拟工具,对于核心模拟体验,它几乎没有已知的错误. Telerik的方法一直专注于简化模拟(通过简单的API +与JusteleCode等其他Telerik工具的集成)和更易于访问(免费版本+商业许可成本低).
Focusing on JustMock, I think you'll find the latest version is a very capable mocking tool with few known bugs for the core mocking experience. Telerik's approach has been to focus on making mocking easier (via a simple API + integration with other Telerik tools, like JustCode) and more accessible (free version + low commercial license cost).
虽然Telerik在模拟游戏中相对较新,但实际上可以使我们的方法受益,因为它能够在第一时间正确处理所有事情,而没有过时的传统模式来弄乱API或文档.
While Telerik is relatively new to the mocking game, that actually benefits our approach by being able to do everything right the first time, with no out-moded legacy modes to clutter the API or documentation.
您注意到的一个主要优点是 JustMock是免费提供的(用于模拟接口/代理/非虚拟方法).然后,如果您需要模拟需要分析器的项目的功能,则是对商业版功能的简单升级.相同的API.相同的工具.探查器功能更强大.
A key advantage, as you note, is that JustMock is available for Free (for mocking interface/delegates/non-virtual method). If you then need the ability to mock items requiring the profiler, it's a simple upgrade to the commercial version's power. Same API. Same tool. Just more power with the profiler.
最好的办法是尝试一下. http://www.telerik.com/justmock
Best thing to do is give it a try. http://www.telerik.com/justmock
您还可以在Telerik TV上查看最近录制的网络研讨会,播放有关JustMock的文章,以查看当前的版本(2011年第一季度): http://tv.telerik.com/watch/telerik/test-drive-your-code-with-justmock
You can also check a recent recorded webinar freaturing JustMock on Telerik TV to see the current version (Q1 2011) in action: http://tv.telerik.com/watch/telerik/test-drive-your-code-with-justmock
希望有帮助.
这篇关于TypeMock VS JustMock(VS RhinoMock,Moq ...):2011年的现状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!