NUnit-based methods supporting unit testing of .NET database applications

Dariusz R Augustyn, Ireneusz Stanek


The paper presents unit testing methods of database functionality using NUnit module. Unit tests should be stateless and independent. Database should have expected content before running of unit test. To fulfill these conditions a mechanism of placing database into know state and database content rollbacking should be used. It could be obtained by an approach based on XML data for setting expected database content. Another described approach uses transaction processing supported by COM+ services for automating rollback of changes made by test. The NUnit extension mechanism used for rollback functionality encapsulation is shown. It simplifying implementation of database functionally unit tests by using specific user defined attributes.


automatization; unit tests; data access layer testing; distributed transaction; COM+ enterprise services

Full Text:

PDF (Polski)


NUnit Home Page:

NMock Home Page:

Burton K. R.: .NET Common Language Runtime Unleashed, SAMS Publishing 2002.

Augustyn D. R.: Rozwój narzędzi programowych wspierających automatyzację testów jednostkowych dla technologii .NET. Bazy danych. Rozwój metod i technologii. Bezpieczeństwo, wybrane technologie i zastosowania. WKŁ, Warszawa 2008.


W3C XML Schema Page,

Glover A.: NDbUnit Home Page:

Balsara M.: Digital Group Infotech Page,

NDbUnit Google Code Page,

NUnit Addins Page:

Hall B.: Testing Times Ahead: Extending NUnit Page, http://www.simple-talk.eom/domet/.net-tools/testing-times-ahead-extending-nunit/.

Schlapsi A.: Row Test Extension Page,

Osherove R.: Simplified Database Unit testing using Enterprise Services Page

Osherove R.: NUnitX and the Rollback attribute Page,

NUnit - XtUnit Page,