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

Dariusz R Augustyn, Ireneusz Stanek

Abstract


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.

Keywords


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

Full Text:

PDF (Polski)

References


NUnit Home Page: http://www.nunit.org.

NMock Home Page: http://www.nmock.org.

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.

ADO.NET MSDN Page, http://msdn.microsoft.com/en-us/library/aa286484.aspx.

W3C XML Schema Page, http://www.w3.org/XML/Schema.

Glover A.: NDbUnit Home Page: http://www.ndbunit.org.

Balsara M.: Digital Group Infotech Page, http://newsletter.thedigitalgroup.com/apr08/technical.html

NDbUnit Google Code Page, http://code.google.eom/p/ndbunit/source/browse.

NUnit Addins Page: http://www.nunit.org/index.php?p=nunitAddins&r=2.4.8.

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, http://bazaar.launchpad.net/~a-schlapsi/nunit-rowtests/trunk/files.

Osherove R.: Simplified Database Unit testing using Enterprise Services Page http://weblogs.asp.net/rosherove/articles/DbUnitTesting.aspx.

Osherove R.: NUnitX and the Rollback attribute Page, http://weblogs.asp.net/rosherove/archive/2004/07/12/180189.aspx.

NUnit - XtUnit Page, http://www.nunit.org/index.php?p=xtunit.




DOI: http://dx.doi.org/10.21936/si2009_v30.n2B.443