Unit testing has become a mainstream task. Most developers do it. Most project leaders and architects expect their team to write tests. However, practice has taught us that a lot of teams write few tests, or spend too much time writing and maintaining them. Different development teams make common mistakes, run into similar issues and find their own solutions for them. This costs a lot of valuable time. Unitils started in 2005 and has emerged from concrete experience and lessons learned, with the ultimate goal of making unit testing easy, effective and maintainable. Unitils offers a lot of support in testing the database layer: automatic maintenance of test databases, automatic post-processing of the database to make it more test-friendly, loading test data using DbUnit and verifying the contents of the database after execution of a test. Unitils provides specific support for testing with JPA or hibernate, and offers integration with spring. It makes abstraction of the testing framework that is used for executing the tests, making it useable with JUnit3, JUnit4 or TestNG. But Unitils is not limited to persistence layer testing only: The reflection assert utility is a very useful alternative to the classic assertEquals method with a range of leniency options. Unitils also provides superior support for dynamic mock objects, offering a simple syntax for specifying method behavior and verifying expectations. This talk will present the different features of Unitils using simple, concrete examples.
Watch this video on JavaZone (click on “Presentation”)