Monday, 29 December 2008

Unitils 2: unitils is dead, long live to spring-test

I appreciate the unitils framework and I used it in practically all the situations where I need an advanced tool for tests and especially integration ones. When I recently discover that a major version was released, I was enthusiastic to see what’s new in this version, especially since they suddenly pass from 1.1 to 2.0. But when I take a look at the official site of the framework, I found that the only significant change, of this major version, was a new mock module or framework!

Personally, and as a user of this tool, I hoped that the next version will be simpler to use, and especially more flexibly configured; because I dislike the fact that I was obliged to configure unitils modules similarly, for all the tests of my project. For example it isn’t possible to deactivate, activate or configure modules per test (more precisely test-class); so it wasn’t simple to use two test-database configurations (a real and a memory one); the database module leaks, also, a facility more flexible than the DbMaintainer. Because if you’re not using Hibernate and its hbm2ddl application, you must manage by yourself your database test schema, and it’s really boring especially for memory database based tests.

Instead of these enhancements, we have only a new mock framework, which I don’t think that I will use instead of frameworks like easymock or jmock, a more stable and reliable solutions. That’s why I believe that it’s time to move to the other option in this field which is Spring-test. In fact, Spring-test has not yet the same capability as unitils, but it’s really simple to extend; and this can be simply done by reusing unitils listeners (from the modules) as spring-test ones. Or to re-implement these features from scratch like it was done in the springdbunit project. Besides being a part of the popular Spring framework it will be surely enhanced and promoted to rich the status of the defacto choice of this category (unitils itself was promoted and made popular by an article on it’s spring-hibernate friendliness).