Is there any open source mocking framework resembling TypeMock? [closed]

ε祈祈猫儿з 提交于 2019-12-09 04:37:48

问题


TypeMock is too expensive for a hobbist like me :)

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

EDIT: This enables features such as:

  • Mocking non-virtual methods and properties (!).
  • Mocking browser environments.
  • simpler syntax which is less fragile (and not having to go trough mock objects).
  • Mocking static methods Sometimes is useful (Mostly in legacy scenarios, involving the dreaded DateTime.Now).
  • And more..

回答1:


TypeMock is too expensive for a hobbist like me

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




回答2:


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.




回答3:


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




回答4:


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?




回答5:


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.




回答6:


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).




回答7:


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.




回答8:


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.)



来源:https://stackoverflow.com/questions/1534119/is-there-any-open-source-mocking-framework-resembling-typemock

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