New Posts New Posts RSS Feed: How tp cleanup after running Unit Tests
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How tp cleanup after running Unit Tests

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: How tp cleanup after running Unit Tests
    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.
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down