Working with ASP.NET Unit Tests

In Microsoft Visual Studio Team System Test Edition, VSTestHost is the process that, by default, hosts unit tests. Specifically, it hosts unit tests that test methods of non-Web applications. But you can also test methods that are part of ASP.NET sites or projects, by running ASP.NET unit tests. By definition, an ASP.NET unit test is a unit test that runs not under the VSTestHost process but rather in the same environment in which the production code will run. For this, you can choose either IIS or the ASP.NET Development Server.


If you are running Windows Vista, you must run Visual Studio as an administrator to run ASP.NET unit tests. If you run Visual Studio as a normal user, you can create a Web site and create and run ASP.NET tests, but the tests will fail. To run Visual Studio as an administrator, right-click Microsoft Visual Studio 2005 and then click Run As Administrator. If you are prompted to Continue, or to Allow the process to run, click Continue or Allow, respectively. If you are prompted to supply logon credentials for a user with administrator permissions, you must supply those credentials to successfully run ASP.NET unit tests. For more information about security in Windows Vista, see User Account Control Overview

Overview of ASP.NET Unit Tests

Introduces ASP.NET unit tests and describes aspects of running them in different processes, such as IIS and the ASP.NET Development Server.

ASP.NET Unit Tests and Private Accessors

Explains why ASP.NET unit tests must use private accessors to run.

How to: Create an ASP.NET Unit Test

Describes how to generate and configure an ASP.NET unit test.

How to: Debug while Running a Test in an ASP.NET Solution

Describes how to debug while running an ASP.NET in the IIS process or in the ASP.NET Development Server process.

Community Additions