19

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..
8
  • please express what you need... otherwise it's not a real question Oct 7, 2009 at 21:02
  • I gotta say this question is worded like an advertisement rather than a question. I will answer with why TypeMock is very likely overkill to counteract this. Oct 9, 2009 at 17:57
  • 5
    This doesn't seem like an advert to me, sounds like someone looking for an OSS alternative to a paid product. If it is an advert, it's possibly the worst one I've ever seen, basically saying "this product costs too much!"
    – dbr
    Oct 9, 2009 at 18:30
  • 1
    The "And more.." with a link to Isolator's website right below a list of TypeMock's (admittedly unique) features? It looks like an advert... sorry if you disagree. Oct 9, 2009 at 18:35
  • 4
    TypeMock is priced absurdly (800$ - 1,200$ per developer!).
    – gkdm
    Oct 9, 2009 at 22:47

8 Answers 8

11

TypeMock is too expensive for a hobbist like me

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

11

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.

1
  • 3
    I don't think it is a matter of ideology, but purely a technical difficulty. Ayende actually said he would accept a patch that adds support for mocking of static methods: ayende.com/Blog/archive/2008/05/20/…
    – Rogério
    Feb 13, 2010 at 12:48
5

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

2
  • Too poor to be working on O/S as well :) (just kidding). The question is out of curiosity.
    – gkdm
    Oct 7, 2009 at 23:25
  • 1
    Not a great idea since now when anyone downloads your source cannot run your tests without a valid license.
    – sjdirect
    Jan 27, 2015 at 3:40
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?

2
1

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.

16
  • 5
    I don't agree, i think non virtual methods have a place in systems built with TDD from the ground up. This is what bothers me the most, it affects my design considerably. Also TypeMock has a syntax with less ceremony which is important for unit-testing.
    – gkdm
    Oct 9, 2009 at 22:57
  • 1
    There's no reason you can't use an interface to avoid having to use virtual methods. In terms of ceremony, I don't see how TypeMock is easier to use than, say, Moq. Oct 10, 2009 at 14:57
  • Right - in case you do not use any 3rd party components and have a green field you do not need to use Typemock Isolator... or do you? Oct 11, 2009 at 6:48
  • 1
    I think if you need to mock an entity, your entities are not designed with the correct separation of concerns. There's no reason to mock an entity. If you do, it's not an entity. Oct 14, 2009 at 16:56
  • 1
    TypeMock is useful, even if you built without testability in mind. Oct 23, 2009 at 4:18
0

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

1
  • How do you plan on achieving this?
    – gkdm
    Dec 5, 2009 at 14:59
0

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.

1
  • Well, with C# 5.0 they plan on opening the compiler for extensions, I think this will help. EDIT: Maybe they will also be so kind as to add a decent interception mechanism.
    – gkdm
    Mar 30, 2010 at 15:47
0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.