NUnit - Database Testing and Automatic Rollback - Unit Testing

I mentioned an article by Roy Osherove in a post about database testing with NUnit.  Roy is unquestionably very good with NUnit :)

Roy has come up with
NUnitX, which is a custom version of the NUnit Framework with a rollback attribute.  When adding the rollback attribute to a test, the test runs inside its own transaction context and automatically rolls back at the end of the test.  How cool is that!  Although I haven't used NUnitX yet, my hopes are that this functionality gets place into NUnit ASAP.

The addition of the Rollback Attribute on a NUnit Test would look like:

[Test,Rollback]
public void Insert()
{
      //Do some inserts into the DB here
      //and the automatically roll back
}

Roy talks more about it
here. Very cool, Roy.

 

posted on Monday, July 12, 2004 6:39 PM

Main

David Hayden Google +

David Hayden Twitter

Health & Fitness

JavaScript Patterns Book Review

HTML 5 and CSS3 - Develop with Tomorrow's Standards Today

Professional ASP.NET Design Patterns Book Review

Beginning Mac Programming Book Review

C# in Depth Book Review

ASP.NET MVC

Orchard CMS

Categories