Condividi tramite


Proprietà IHostedTest.HostType

La stringa IHostedTest.HostType identifica un host. I tester possono utilizzare questa stringa nell'attributo HostType in un test personalizzato per specificare un host in cui eseguire quel test.

Spazio dei nomi:  Microsoft.VisualStudio.TestTools.Common
Assembly:  Microsoft.VisualStudio.QualityTools.Common (in Microsoft.VisualStudio.QualityTools.Common.dll)

Sintassi

'Dichiarazione
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)

Valore proprietà

Tipo: String
Oggetto String contenente il nome del tipo di host nel quale deve essere eseguito il test.Per indicare l'host del test predefinito, questa proprietà restituisce null o una stringa vuota.

Note

Per unit test, l'attributo HostType nel quale è possibile utilizzare questa stringa viene da Unit Testing Framework.

La classe TestElement implementa l'interfaccia IHostedTest. Per i tipi di test che non derivano da TestElement, lo sviluppatore del tipo di test deve consentire agli utenti del test di specificare il tipo di host da utilizzare quando eseguono i test. Come descritto in How to: Specify Tests to Run in a Host Adapter, è possibile eseguire questa operazione impostando la proprietà nel finestra Proprietà, tramite l'attributo HostType (per gli unit test) o supportando l'editor di configurazione dell'esecuzione del test.

Esempi

Per il codice completo dell'esempio seguente, vedere il file MyTest.cs nell'esempio di estensibilità dei test in Visual Studio SDK. Non è necessario includere gli elementi seguenti se il tipo di test personalizzato deriva da TestElement.

private string m_hostType;
string IHostedTest.HostType
{
    get
    {
        return m_hostType;
    }
    set
    {
        m_hostType = value;
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

IHostedTest Interfaccia

Spazio dei nomi Microsoft.VisualStudio.TestTools.Common

Altre risorse

How to: Specify Tests to Run in a Host Adapter