共用方式為


TestContext.TestName Property

Gets the test name.

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

Syntax

'Declaration
Public Overridable ReadOnly Property TestName As String
public virtual string TestName { get; }
public:
virtual property String^ TestName {
    String^ get ();
}
abstract TestName : string with get 
override TestName : string with get
function get TestName () : String

Property Value

Type: String
The test name.

Exceptions

Exception Condition
InvalidCastException

An invalid value type is associated with the TestName property of the test context.

.NET Framework Security

See Also

Reference

TestContext Class

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

Other Resources

Using the TestContext Class