Unit Testing with Database Rollbacks

One of the tricky things with unit testing is getting your test system back to a known state after a test run. If your code involves a lot of database changes, then you often have to go to elaborate lengths like keeping track of all objects & deleting them afterwards, or restoring a database from a recent backup. Ugh.

I just read about EntryZero”s dataFresh and it looks interesting. From their site:

Entropy”s dataFresh is a toolkit that assists test driven online casino nederlandsegokken development projects in restoring their database to a known state before each test within a test fixture. The time consuming effort of having to write tear down methods to clean up the database after running your tests are a thing of the past.

Our appoach is unlike others as we do not attempt to rip and replace the entire database. Instead we track database modifications to the table level and only work with those tables that have been modified.

So, it might be worth checking it. Currently it only works with SQL Server 2000 & 2005.

0