I’ve blogged earlier about my love for MockEJB… and I’ve since come across MockRunner which not only lets you test EJBs outside the container… it lets you test Servlets, Tags and Struts apps to boot (it actually uses MockEJB to do the underlying EJB stuff, but gives you a nice high level facade to make it happen). Comes with a mock JDBC layer as well (to mock in your DB implementation).

I have a servlet which called a session bean, passing in some info gathered from the HttpSession scope, and now I’ve got unit tests for the whole process running entirely outside the container. You’ve just gotta love that. The best part is that it passes the Glen Smith “just works” test - up and running within the hour courtesy of some nice example code from their web site.

A little heavy on the dependent jars (commons-just-about-everything.jar), but we don’t have to ship em right? Just for for our Ant test classpathref.

Good stuff, lads. A very neat library.