Is there any open source mocking framework resembling TypeMock?

て烟熏妆下的殇ゞ 提交于 2019-12-03 02:36:32

TypeMock is too expensive for a hobbist like me

It's probably also too expensive to develop and release for free.

Declaimer I work at Typemock.

I'll try to answer your questions:

Is there any open source mocking framework resembling TypeMock?

The only other framework that is using the profiler API is the (commercial) JustMock.

Moq or the next version of RhinoMocks have no plans on listening to the profiling API, why is that?

I think it's a matter ideology. Ayende the creator Rhino mocks and Kzu the creator of moq believes in design for testability and that mocking framework should help you to achieve this design so they will not implement the features of Isolator even if it was easy.

TypeMock is too expensive for a hobbist like me

If you are working from home you can buy a cheaper personal license (I don't want to post a link to the Isolator buy page here but I'm sure you can find it.)

Hope it helps.

If you are working on Open Source, you can get a free license of Typemock Isolator (but only for use with that).

Moq or the next version of RhinoMocks have no plans on listening to the profiling API, why is that?

Because it is very, very hard and requires a bit of C++ knowledge?

Because TypeMock is only useful if you are testing code that was not written with testability in mind. There are a limited set of circumstances where this is useful and can generally be worked around.

In short, TypeMock is useful for programmers who:

  • don't have much experience with TDD and haven't figured out how to write code for testability
  • have a lot of legacy code lying around that need to have test fixtures strapped onto it

This makes this very valuable for those few people who need this feature, but for free software the cost vs. community benefit is very low.

Check out http://beanproxy.codeplex.com/ . It's a tool I've been developing for some time. It does not yet allow non-virtual proxies (aside from abstract and interfaces) and it doesn't support live objects (proxying live objects). However, it is free and open source. It super easy to use and it still being developed (there are plans to support non virtuals and live objects).

gkdm asked me how I plan on adding proxy support to http://beanproxy.codeplex.com/ for static and live objects, my answer is that I have no idea how. I studied a variety of ideas; none of which worked out. The closest solution I had was to create a profiling library, but this would require the tester to run my library as a profiler, and she wouldn't be able to just run my library with her tests. I spent days reading and testing ideas, nothing worked. I've given up that search but would be open to ideas again if anyone has any. Beanproxy is still a great tool that many fellow developers use. Use the issue and discussion tabs on codeplex if you have any specific needs or concerns about beanproxy. I'm always looking to improve it.

I understand this question is for the .NET world, but in case someone is wondering what exists in the Java world, I can say that the answer would be "yes, there is".

The JMockit toolkit is open source (MIT license), and unless I missed something, it's even more powerful than TypeMock. (Specifically, I don't see anything in TypeMock that would be equivalent to the functionality provided through the @Capturing annotation in JMockit.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!