|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Creating and Using Host Adapters
A host is a test execution environment, an application process in which test code is executed, and in the case of unit tests, production code as well. Team Edition for Testers provides a default test host, VSTestHost.exe. By default, tests are executed in the VSTestHost.exe process.
There are limitations on running tests using the default test host. For example, when you run unit tests in VSTestHost.exe, the production code is not executed in its real execution environment.
Sometimes, and more importantly, production code may not work when not running in its real execution environment. A typical example is that of unit tests for ASP.NET Web applications. The ASP.NET application code may need to access the ASP.NET context, which makes objects such as the HttpSessionState, HttpApplication, and HttpRequest available to the application code.
Also, page-specific objects must be initialized properly so that application code that works with them can run without throwing exceptions. VSTestHost.exe cannot provide the ASP.NET context nor these runtime objects. Team Edition for Testers overcomes this problem by using an ASP.NET host adapter. It lets you run unit tests for ASP.NET Web applications in the IIS process or in an ASP.NET Development Server process.
There are other situations in which you want to execute tests in hosts other than the default test host. Team Edition for Testers provides the means by which you can develop your own host adapters to achieve that.
The Help topics in this section describe how to build and install such a host adapter, and to use it when you run tests.