One of the steps all good developers take when developing anapplication is unit testing. Unit testing involves testing a single method orfunction to ensure it is behaving as expected. From what I've seen throughreal life experience is that when a developer initially develops his or hermethod they thoroughly unit test it. However, when changes are made for a newrelease I've seen the process fall apart. A lot of time developers make thechange that was requested and only test the scenario that was requested withoutgoing back to make sure other scenarios didn't break. I'm guilty of thismyself.
Visual Studio has a great unit testing framework which canhelp solve this problem. You can build unit testing scripts, which are essentiallyclasses that call your code that you can then execute to determine if you'recode is working correctly. When you make an enhancement or re-factor your codeyou can simply run the unit test scripts to determine that the code is stillfunctioning properly. It will take you extra time to initially develop yourcode but it is worth the investment knowing that your code is working correctlyand that you can more easily maintain your code with confidence.
This article will show you how to create an ASP.NETapplication and how to unit test the ASP.NET web page and a public class in aclass project. It will also demonstrate how to execute your unit testsindividually or in a group. The code for this sample can be found here.
(2011-04-16 22:28:52, Size: 102 KB, Downloads: 1)
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/11379785/viewspace-692812/，如需转载，请注明出处，否则将追究法律责任。