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)
Syntax
'Declaration
Property HostType As String
string HostType { get; set; }
property String^ HostType {
String^ get ();
void set (String^ value);
}
abstract HostType : string with get, set
function get HostType () : String
function set HostType (value : String)
Property Value
Type: 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.
Remarks
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.
Examples
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;
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.TestTools.Common Namespace