Print Page | Close Window

How tp cleanup after running Unit Tests

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=229
Printed Date: 27-Mar-2025 at 7:24pm


Topic: How tp cleanup after running Unit Tests
Posted By: Customer
Subject: How tp cleanup after running Unit Tests
Date Posted: 12-Jul-2007 at 4:40pm
I'm starting to learn the IdeaBlade ORM.   I'm trying to get some existing NUnit tests running.  In our current application we begin a transaction during SetUp, and then roll back the transaction during a TearDown method.  This ensures that the unit test database's contents do not ever get modified.

I'm having difficulty figuring out how to do this with IdeaBlade.  CheckPoints do not seem to be the answer.  Any insights you could provide will be greatly appreciated.



Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 4:41pm

DevForce does not support your transactional approach.  We do transactional saves as part of the SaveChanges method, but we do not support the ability to start a transaction, do a whole bunch of database operations, and then rollback the entire set of database operations.  According to our CTO, supporting long running transactions of this type is a bad idea.  Instead he believes that you should start and complete transactions as quickly as possible. 

I agree with you that CheckPointing is not the ultimate answer.  While Checkpointing may be a great solution the vast majority of the time, a big problem is that if the application crashes, there is no way to undo the database changes.

Our current strategy is to develop a “Cleanup” test that restores the database by programmatically applying fixes to the database.  For example, we may delete all employees with an ID greater than 1000 after first deleting all of their orders and order details.

 At some point in the future, we may develop a more robust solution by using database restore.

 




Print Page | Close Window