Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IHostedTest::HostType Property

 

The IHostedTest.HostType string identifies a host. Testers can use this string in the HostType attribute on a custom test to specify a host in which to run that test.

Namespace:   Microsoft.VisualStudio.TestTools.Common
Assembly:  Microsoft.VisualStudio.QualityTools.Common (in Microsoft.VisualStudio.QualityTools.Common.dll)

property String^ HostType {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The String that contains the name of the type of host in which the test should run. To indicate the default test host, this property returns null or an empty string.

For unit tests, the HostType attribute in which you can use this string comes from the Unit Testing Framework.

The TestElement class implements the IHostedTest interface. For test types that do not derive from TestElement, the developer of the test type must enable test users to specify the host type to use when they run tests. As described in How to: Specify Tests to Run in a Host Adapter, you can do this either by setting properties in the Properties window, by using the HostType attribute (for unit tests), or by supporting the test run configuration editor.

Legacy Code Example

For the complete code of the following example, see the MyTest.cs file in the test extensibility sample in the Visual Studio SDK. You do not have to include the following if your custom test type derives from TestElement.

private string m_hostType;
string IHostedTest.HostType
{
    get
    {
        return m_hostType;
    }
    set
    {
        m_hostType = value;
    }
}
Return to top
Show: