Unit testing user controls in ASP.NET applications

May 30, 2008 at 4:43 PMalex

 

After trying several times to start writing a testing framework for UI layer in one of my applications, which I should acknowledge were not really successful, I finally came across the Scott's blog post on best practices related to reusing the user controls between the projects at http://msdn.microsoft.com/en-us/library/aa479564.aspx. The trick is to reuse the user control from the application in another project, which implements the test harness. In just under an hour, the working prototype was created in Visual Studio 2005. And this does not require any third-party tools such as NUnitAsp and could be build from the scratch, which I prefer over the bloating the code with unnecessary dependencies on the external tools. Alright, so that means that the work can be done in truly test-driven approach and result in to the higher quality of code.

Posted in: Development

Tags: