TriggerUnit is an extension to DBUnit and JUnit4 to create unit tests for database triggers.
Database triggers are often a critical part of todays business applications, but they are usually not integrated into the software engineering process.
TriggerUnit tries to change that by providing an simple and powerful framework for database trigger testing.
Database trigger unit tests are created using a simple jave framework based on DBUnit and JUnit.
Integrating development of database triggers into the software engineering process, gives advantages
like running unit tests on continuous integration server or measuring test coverage of your triggers.
It also makes the quality of your SQL code more visible and lowers gaps between software developers (e.g. java code, c# code) and database developers.
The main goals of TriggerUnit are:
- Integration of database triggers into the software engineering process
- Allow test driven development of database triggers
- Provide a simple framework to create unit tests for database triggers
- Only minimal changes on test data when database schemas or business logic changes
Each test is executed in the following lifecycle on a real database
1. Connect to database
2. Initialize database schema with predefined test data (e.g. defined in XML)
3. Create SQL triggers in the database
4. Execute one insert/update/delete statement on the predefined data (should call trigger)
5. Check against expected data to see if the trigger did run correctly
6. Continue with next test case and step 1