The idea of DbFixture came out of two projects that we have worked on, both of which involve building
our own data access layer for special reason. After the end of the second project, we put together the
requirement and wrote this library.
Wiki (Confluence) is the formal way of documentation: http://confluence.public.thoughtworks.org/display/DBFIX/Home
Please note that this page is not as up-to-date.
Alpha release ready for easy preview: dbfixture-alpha.zip
The goal of DbFixture is to make database testing easy. Ideally you would want to have a O/R mapping
framework doing all the database access for you. However this is not a perfect world, for various reasons
from non-standard legacy database to verifying a potential defect in the framework, it is desirable to
be able to test it in an easy way. DbFixture achieve that in the following aspect:
- Proxy SQL driver that will set up the database automatically upon the first connection, based on the
registered schema. In this way, your production code will not be changed as long as the jdbc connection
properties (JDBC URL, user name, password) are not hard-coded (which is a good design anyway).
- Helper classes to assist retrieving row from the table. This is done in a generic way so that
the test can be done against any database connection. All SQLExceptions are being wrapped in
SqlRuntime so that your test code don't have to deal with them.
- Resource Monitoring: Through the SQL proxy driver, it can monitor all the resources (Statement
and ResoultSet) so that it can verify that they are all closed.
- Resource Managing: All resources that was allocated for assertions can be closed
This one minute tutorial shows how the DbFixture is to be used by tests.
DbFixtureApiTest in folder api-test
This is the diagram that shows the current design and how this library is to be used.