Configuring Host Adapters and Test Types

By using two individual registry settings, you can adjust the ways that test types and host adapters work together. Any change to these settings affects all existing test types and all existing host adapters, such as the ASP.NET host adapter. The settings affect both individual tests and aggregation test types, such as load tests and ordered tests.

Example: Using a Host Adapter

To enable a particular test type to run on a particular host adapter, set the values for the test type's registry key (SupportedHostAdapters) and for the host adapter's registry key (SupportedTestTypes). You can set them as part of the installation of the test type and the host adapter. You must set them before you run any tests that involve both parts, or the test might not run. The following scenario describes ways in which these settings are used:

  1. A software vendor develops a host adapter, H, for a specific kind of mobile device. The purpose of this host adapter is to enable application testers to run unit tests and generic tests on the mobile device.

  2. A mobile-device software company purchases the device-specific host adapter. After their testers install it, they use it to run unit tests and generic tests on the mobile device. As part of the installation, the SupportedTestTypes registry setting is set for the host adapter, and the SupportedHostAdapters registry setting is set for both the unit test type and the generic test type.

  3. Another software vendor develops a test type, T, for mobile-device applications. The vendor's testers verify that test type T works with host adapter H. Testers use registry settings for both the test type (SupportedHostAdapters) and the host adapter (SupportedTestTypes) to make sure that they work together.

  4. The mobile device software company purchases test type T and their testers install it. Now, by using host adapter H on the mobile device, they can run tests of three types: unit, generic, and tests of type T. Testers use registry settings for both the test type (SupportedHostAdapters) and the host adapter (SupportedTestTypes) to make sure that they work together.

Matching Host Adapter Settings with Test Type Settings

To control which test types run on which host adapters, you set behaviors for each, as described in the following table.

Test Types Settings

You can assign one of the following behaviors to a test type:

  • None (default). This test type cannot be hosted by any host adapter.

  • Some. This test type can be hosted by some known host adapters. To determine which host adapters can host the test type, list their IDs as value name entries under the SupportedHostAdapters registry key. In the following table, "host adapter agrees" means that the host adapter's registry key, SupportedTestTypes, lists the ID of the test type in question.

  • Delegate. This test type can be hosted by any host adapter that explicitly accepts the test type.

  • All. This test type can be hosted by all host adapters.

Host Adapter Settings

You can assign one of the following behaviors to a host adapter:

  • Some. This host adapter can host some known test types. In the following table, "test type agrees" means that the test type's registry key, SupportedHostAdapters, lists the ID of the host adapter in question.

  • All (default). This host adapter can host all test types.

Can this test type run on this host adapter?

Test type Setting: None

Test type Setting: Some

Test type Setting: Delegate

Test type Setting: All

Host Adapter setting: Some

No

If both host adapter and test type agree, Yes.

Otherwise, no.

If host adapter agrees, Yes. Otherwise, No.

If host adapter agrees, Yes. Otherwise, No.

Host Adapter setting: All

No

If test type agrees, Yes.

Otherwise, No.

No

Yes

Using Registry Settings

The registry settings are checked at runtime to determine whether a test can be hosted in a specified host adapter.

When a particular test type cannot be hosted by the specified host adapter, you must determine whether to switch the execution to the default test host (VsTestHost.exe) or to skip the execution of the test, in which case the test returns a result of NotExecuted. You can make these settings in the test run configuration dialog box. For more information, see <link to test run configuration information>.

Registry Settings for Test Types

Use the SupportedHostAdapters registry key to determine which host adapters a particular test type can run on. The following information describes the registry key:

  • Key Path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version of Visual Studio>\EnterpriseTools\QualityTools\TestTypes\<GUID of the test type>

  • Key Name: SupportedHostAdapters

  • Default Value: This value is not used.

  • Usage: To hold a list of registry values for all supported host adapters.

  • Exceptions: If the SupportedHostAdapters key is missing, the test type cannot be hosted by any host adapters. This case is equivalent to there being no value name entries under the SupportedHostAdapters registry key.

The following information applies to the values under the SupportedHostAdapters registry key:

  • Value path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version of Visual Studio>\EnterpriseTools\QualityTools\TestTypes\<GUID of the test type>/SupportedHostAdapters

  • Value name: Host Adapter ID. This is a string, such as 'ASP.NET' or '*' or 'Delegate'

  • Value type: REG_SZ

  • Valid values: Short description of the host adapter.

  • Usage: You can use multiple Host Adapter ID values. Each value represents one host adapter that this test type supports. The value '*' indicates this test type supports all host adapters. If you use a value of '*', no other value entries are necessary. A value of 'Delegate' indicates this test type supports only host adapters that explicitly support this test type. If you use a value of 'Delegate', no other value entries are necessary. If you use both '*' and 'Delegate', 'Delegate' will be used.

  • Exceptions: If there is no value name entry under the “SupportedHostAdapters” registry key, this test type cannot support any host adapters. This case is equivalent to the “SupportedHostAdapters” key being missing. Invalid values are ignored and they do not affect this feature behavior.

Registry Settings for Host Adapters

Use the SupportedTestTypes registry key to determine which test types will run on a particular host adapter. The following information describes the registry key:

  • Key Path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\HostAdapters\<Host Adapter String Name>

  • Key Name: SupportedTestTypes

  • Default Value: This value is not used.

  • Usage: To hold a list of registry values for all supported test types.

  • Exceptions: All host adapters require this key. If the key is missing or its value name entries are empty, the host adapter will not be able to host any test types.

The following information applies to the values under the SupportedTestTypes registry key:

  • Value path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version of Visual Studio>\EnterpriseTools\QualityTools\HostAdapters\<Host Adapter String Name>\SupportedTestTypes

  • Value name: GUIDs of Test Types, or '*'

  • Value type: REG_SZ

  • Valid values: Short description of the test type.

  • Usage: Each registry value entry represents one test type that this host adapter can host. You can use multiple such registry value entries. The value '*' indicates that this host adapter supports all test types. If you use a value of '*', no other value entries are necessary.

  • Exceptions: At least one value under the “SupportedTestTypes” key is required. If no values are supplied, the host adapter will not be able to host any test types.

See Also

Concepts

Overview of Host Adapters