Tuesday, 16 December 2008

New Mocking Frameworks (C++ and Java)

Over the last couple of months (maybe half a year) there's a big discussion whether TDD/AUT is here to stay or is it just a passing fashion.

I cant predict the future and as much as I believe in these concepts, only time will tell. However, since I'm paranoid by nature, I'm always on the lookout for indications that TDD is here to stay. A strong indication for me is the creation of new tools to help and simplify the writing of unit tests.

I don't know if this is a pure incident or if someone up there is orchestrating all these but during the last week I was introduced not to one but to two new tools out there. Both of them are new mocking frameworks.

The first one is a a mocking framework for C++ released by no other then Google! (named GoogleMock) this framework complete the unit testing framework Google release not too long ago (GoogleTest).

The second framework is a really cool mocking framework released for the Java language - PowerMock. Like JMockit and the .NET counterpart Isolator this framework is based on the principle of Interception (achieved by bytecode manipulation/CLR code injection)  and will allow mocking any (and I mean ANY) kind of method, including Static, Private and Final methods.

For me this has been a productive week for tool developers.


Soon Hui said...

Hopefully the release of GoogleMock is good enough to convince the managers who think that "writing unit tests are a waste of time".

Lior Friedman said...

I think that you are right.
Saying that Google and Microsoft are doing it, is sometimes not enough.

Showing that they develop tools for this should do the trick.

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Walgreens Printable Coupons