NUnit Article Published (for real this time)

http://msdn.microsoft.com/asp.net/?pull=/library/en-us/dnaspp/html/aspnet-testwithnunit.asp

This is my latest MSDN article, an introduction to NUnit as well as some lessons learned for unit testing a data access layer.  I don't claim to be a unit testing expert, but these techniques have definitely helped me when I have had the discipline to apply them.  Hopefully it will help a few folks to avoid some of the problems I encountered along the way.

2 Comments



  • Thanks Steve... I read this article last night and would recommend it to anyone else that has gone down the Unit testing path and given up because of the complexity of testing against data-centric apps. The tips and, especially the links that you provided were excellent. You've inspired me to give Unit testing one more chance ;-)

  • Steve -- this is a good article, and I liked your thought process in deciding the best ways to test your data access layer.



    One item that I have struggled with, and you touched on it briefly, is the use of Mock Objects in place of the database. As I understand unit tests, you try to isolate the code you are testing, and when you introduce another layer in the test (in this case the database), your unit test can become a functional test instead. At least, this is my thought. As you mentioned, though, you can write set up/tear down stored procedures pretty easily (and maybe more easily than writing mock objects).



    I have linked back to an entry I made regarding unit testing stored procedures in SQL Server. This is another layer/level that I think is important in unit testing.



    Thanks for the article to stir some good thoughts on unit testing for the data side.

Comments have been disabled for this content.