Typemock Isolator Review – Part 4


In the final part of my review, I first want to go discuss SOLID in relation to Isolator, and then to wrap up the review.

SOLID and Isolator

I won’t go into details on what SOLID is – read the link above if you don’t know – but using Typemock Isolator allows you to write code that does not adhere to some parts of SOLID yet is still testable. Specifically, I’m referring to DIP, and to a lesser extent SRP. Is this a bad thing? In my humble opinion – yes and no.

SRP

Let’s imagine you testing a method in a class – let’s call it Foo(). Foo calls another method, Bar(). You want to test out Foo in isolation of Bar because Bar does so much other stuff that it takes too much effort to arrange your unit tests up. In reality this sounds to me like you’re probably violating SRP, and I would split the classes into two, and test each one in isolation.

With Typemock you can simply fake out Bar(), and you get your unit tests running nice and quickly, at the cost of SRP remaining violated. You can do the same sort of thing with other mocking frameworks, but you would have to make Bar a virtual method first.

DIP

DIP tells us that we should depend on abstractions rather than concretes; this reduces coupling and increasing flexibility of our codebase. Obviously this is normally also a precursor for effective unit testing, except that with Isolator where you don’t have to bother doing this. Simply new up your dependencies as private readonly fields in your class and away you go!

Is this a bad thing? Again, it depends. If you know that you’re never going to change the dependency between two classes, and you’ve got an interface in the middle solely to aid unit testing – then perhaps not.

If, on the other hand, you do want flexibility to plug in a different implementation of a dependency later (and gain the benefits of not having downward-facing assembly references), or you have two teams working alongside each others code and want them to continue working without relying on the other team etc. etc. then you I think that you should still adhere to DIP.

Conclusion

Typemock Isolator looks to be a quality product. I’ve not touched on many of the different parts of the Isolator family – there’s a Sharepoint component, a C++ component etc., nor have I discussed the IDE enhancements like IntelliTest, which is a set of IDE enhancements (similar to CodeRush) to help you create fakes quickly. However, I was not that impressed when I tried it as it only offered suggestions for fakes created in the same method (rather than in your test initialise).

It’s certainly a very powerful faking framework with an easy-to-learn API; of course, as I’ve discussed above, it’s not an excuse to avoid use of best practices design patterns.

Its more powerful features really come into use on brownfield projects where you have a codebase that perhaps has not been designed with testability in mind, yet you perhaps still want to quickly get a set of tests up and running quickly. Indeed, because of its ability mock to live objects, you can quickly train up unit testing-newbies without having to explain concepts such as DI and IoC frameworks to them.

I’ve avoided discussing pricing throughout the article because I wanted to concentrate on the technology and product itself, but I’ll briefly touch on it here. At the time of writing, each developer license will set you back €800 – and a build server license costs a stonking €2,499.  As an upfront cost for a medium-sized development team, it’s not exactly cheap. Compare this price to Telerik’s JustMock, a relatively new commerical mocking framework, which costs ~€200 per developer license. I haven’t tried it (so can’t comment fully on it), but the website claims to have the same sort of feature set as Isolator (including apparently faking all of mscorlib).

As I said earlier, you (or your boss!) would need take a view on how much cost savings you’d be getting from Isolator over time and how long it would take you to get your investment back on that, but there’s no denying the quality of the product – it’s a powerful and seamless unit testing experience that’s one of the easier unit testing frameworks to pick up.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s