Unitils' goal is to make unit-testing easy and maintainable by offering utilities such as automatic DB-schema maintenance and equality assertion through reflection.
Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils builds further on existing libraries like DBUnit and EasyMock and integrates with JUnit and TestNG .
Unitils provides general asserion utilities, support for database testing, support for testing with mock objects and offers integration with Spring , Hibernate and the Java Persistence API (JPA). It has been designed to offer these services to unit tests in a very configurable and loosely coupled way. As a result, services can be added and extended very easily.
Here are some key features of "Unitils":
General testing utilities:
· Equality assertion through reflection, with different options like ignoring Java default/null values and ignoring order of collections
Mock objects support:
· Dynamically define stub behavior of and verify invocations on mock object using a simple syntax.
· Optimal feedback including a simple and extended execution scenario report and suggested assert statements.
· Use argument matchers for relaxing method parameter constraints and mix them with concrete objects. Use null when the actual argument value is not important.
· Use dummy objects when stub data objects without any required behavior are needed.
Persistence layer testing support:
· Automatic maintenance of databases, with support for incremental, repeatable and post processing scripts
· Automatically disable constraints and set sequences to a minimum value
· Support for Oracle, Hsqldb, MySql, DB2, Postgresql, MsSql and Derby
· Simplify test database connection setup
· Simple insertion of test data with DBUnit
· Run tests in a transaction
· JPA entity manager creation and injection for hibernate, toplink and openjpa
· Hibernate SessionFactory creation and session management
· Automatically test the mapping of JPA entities / hibernate mapped objects with the database
EasyMock integration support:
· Simplify EasyMock mock object creation
· Simplify mock object injection
· EasyMock argument matching using reflection equality
· ApplicationContext configuration and easy injection of spring managed beans into a unit test
· Support for using a Spring-configured Hibernate SessionFactory in unit tests.
· Java 2 Standard Edition Runtime Environment
What's New in This Release: [ read full changelog ]
· We're proud to announce the new major version! In this version adds a new module has been added for writing tests with mock objects. The DbMaintainer has been extended with a number of new features and several bugs were fixed.