Unit testing of Data Access Layer code#
One of the parts where Unit testing seems to fall apart, or become a giant pain at least, is in applications or parts of applications that rely heavily on data access from a large relational database like sql server.

You run some operations against the database and end up with a result set. Is that result set right? Ok it looks good, now what? Well some people would say that you should restore the DB to the point before you started this last test. This can be very painful if you are trying to run hundreds, or even simply dozens of tests.

In this article on MSDN the author goes over some options for avoiding the use of database restore. There is some talk about using mock objects in conjunction with NMock, which of course Fowler would like to remind you aren't stubs, but the majority of the article focuses on the use of DTC to rollback changes made in each test teardown.

I had some problems getting DTC to run across machines, but it worked great locally, so there was some success in my tests.
Categories:
Thursday, March 16, 2006 12:37:19 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

All content © 2008, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 1.9.6264.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: