[hibernate-dev] Hibernate test suite

Steve Ebersole steve.ebersole at jboss.com
Tue Dec 12 18:32:47 EST 2006


I am just now checking in the reorganization of the Hibernate test suite
I have been working on for the last few days.

The main piece is the addition of the org.hibernate.junit package in the
test source directory.  Specifically, tests in the test suite now have
two well defined flavors:
1) org.hibernate.junit.UnitTestCase
2) org.hibernate.junit.functional.FunctionalTestCase

The vast majority of the Hibernate test suite falls into the later
category...

Also, a new custom TestSuite subclass was introduced for
FunctionalTestCase classes
(org.hibernate.junit.functional.FunctionalTestClassTestSuite).
FunctionalTestCase classes should use this custom test suite from their
suite() method.  The main reason for this set up is to allow better
sharing of a SessionFactory between TestCase methods.  Previously, the
org.hibernate.test.TestCase class had this responsibility.  The problems
being that it did not have visibility into when the "run" completed.  So
it just left the schema for the last run test hanging around.  This new
set up makes sure that does not happen, because it is the test suite
which is responsible for building/closing the SessionFactory.
FunctionalTestCase does build a SessionFactory if one is not injected
into it by FunctionalTestClassTestSuite (or some other source).  It
considers this a "locally managed" SessionFactory which will get closed
after the completion of the test method; this is for running a single
method in an IDE.

Anyway, the test suite should start working again ;)





More information about the hibernate-dev mailing list