VirtualMock on Hold until Further Notice
I have decided to formally and permanently suspend VirtualMock development for now, for the following reasons:
- The rise of jMock as a killer mock API, which blows away my homegrown Easymock-clone API currently implemented in VirtualMock.
- The realization that any new-code project would be much better off using jMock, since jMock, coupled with a good Test-Driven Development approach, will greatly increase the chances of producing high-quality code, just as the jMock authors claim.
- The realization that, because jMock is a much better choice for a new project, the VirtualMock approach is really only suited for legacy projects. For example, where management won't let you touch the existing codebase, or when you have the chicken-and-egg situation of wanting to refactor untestable legacy code, but don't have any safety net of tests to catch anything you break during refactoring. However, even in these cases there can be alternatives which allow you to use jMock, such as subclassing or wrapping interfaces and facades around legacy code.
- My plans to rewrite VirtualMock from the ground up with a "pluggable" architecture. This will allow the use of the native jMock or EasyMock APIs "on top of" a core VirtualMock API which lets you do things jMock and EasyMock don't, such as mocking classes containing constructors with side effects, mocking statics and finals, etc, etc.
- My plans to abstract the core "Type Interception" logic out to a separate TypeInterceptor project, which will be used as a library or proof-of-concept on which to base the core VirtualMock functionality.
- My plans to offer more lightweight and less intrusive solutions than the current "weave every method in the world" approach used to implement VirtualMock.
- The current "in-flux" state of the AOP world, with the pending merge of AspectWerkz and AspectJ, and the arrival of other cool stuff like AWProxy. I want to let these things shake out more before I pick up again on VirtualMock and start rewriting the codebase.
- The arrival of Java 1.5, which promises to change a lot of stuff related to testing and AOP via Annotations and other features.
- My plans to do a complete rewrite so I can apply some "lessons learned" since my initial VirtualMock implementation. For example, more injection, less inheritance, more simplicity, better build processes, etc., etc.
- My severe lack of free time due to personal and work obligations, and my involvement in other open source projects (such as EMMA)
So, I would officially Not Recommend the usage of VirtualMock in it's current form, since any future version will could likely be very non-backward compatible. For any new code, I would firmly recommend the use of jMock with Test-Driven Development. I'm convinced, through experience, that this is the way to write good code. Trust me, and a lot of people who are a lot smarter than me, and give it a good long try. Even if you have some legacy code which is difficult to test, first explore alternatives which allow you to use jMock, such as subclassing or wrapping interfaces and facades around legacy code. If that still doesn't work, roll up your sleeves, and write some homegrown aspects to do what you want (and be sure to keep me updated on what you do, any new ideas are welcome!). Nick Lesiecki's seminal article on this topic, Test flexibly with AspectJ and mock objects, is still an excellent starting place.
Many thanks to all the people who helped and supported VirtualMock thus far. I definitely plan to revisit it when the time is right, because I still know there is a lot of difficult-to-test legacy code out there, which is the niche for VirtualMock to make developer's lives easier.
What is VirtualMock?
VirtualMock is a Java unit testing tool which supports the Mock Objects testing approach. Through the use of Aspect-Oriented Programming, it is designed to address some of the limitations of existing Mock Object tools and approaches.
Thanks to the following people and organizations for their encouragement, input and support:
Simon Monk, Stephen Hall, Frank Westphal, Michael Feathers, Jonas Bon?r, Alex Vasseur, Carlos Villela, Nicholas Lesiecki, Ron Bodkin, Felix Guerrero, Larry Gorman, J. B. Rainsberger, Mark Hellkamp, Vincent Massol, mockobjects.com, jmock.org, EasyMock, the Test Driven Development mailing list community
VirtualMock is hosted on SourceForge.