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.
The goal of DbFixture is to make databane 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 SQLException 's are being wrapped in SqlRuntimeException so that your test code doesn't have to deal with them.
- Helper classes to assis setting up database by generate insert SQL statement based on the object instance argement using reflection.
- For project that uses database specific SQL (not that we recommend it), a pluggable sql converter to convert them into something that HSQL understands so that you don't have to change your code.
- Resource Monitoring: Through the SQL proxy driver, it can monitor all the resourcs (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 automatically.
GForge opensource server is one of the ThoughtWorks' Public Services
This project is still in development and has not made any release. You can post in the forum to request one, or build it yourself using Maven2.
Alpha release for preview: dbfixture-alpha.zip
- One Minute Tutorial
- Test-Driven Development Using Hibernate
- Test-Driven Development Using iBatis
A Overall Design review is still under construction.
|Type of Access
Please use the issue tracker, or post in the project forum.