Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

TestMethodAttribute Class

Definition

Namespace:
Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:
Microsoft.VisualStudio.TestPlatform.TestFramework.dll
Assembly:
MSTest.TestFramework.dll
Assembly:
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Package:
MSTest.TestFramework v1.1.18
Package:
MSTest.TestFramework v1.2.1
Package:
MSTest.TestFramework v1.3.2
Package:
MSTest.TestFramework v1.4.0
Package:
MSTest.TestFramework v2.0.0
Package:
MSTest.TestFramework v2.1.2
Package:
MSTest.TestFramework v2.2.10
Package:
MSTest.TestFramework v3.0.4
Package:
MSTest.TestFramework v3.1.1
Package:
MSTest.TestFramework v3.10.5
Package:
MSTest.TestFramework v3.11.0
Package:
MSTest.TestFramework v3.2.2
Package:
MSTest.TestFramework v3.3.1
Package:
MSTest.TestFramework v3.4.3
Package:
MSTest.TestFramework v3.5.2
Package:
MSTest.TestFramework v3.6.4
Package:
MSTest.TestFramework v3.7.3
Package:
MSTest.TestFramework v3.8.3
Package:
MSTest.TestFramework v3.9.3
Package:
MSTest.TestFramework v4.0.2
Package:
MSTest.TestFramework v4.1.0
Package:
MSTest.TestFramework v4.2.3
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs
Source:
TestMethodAttribute.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

This attribute is used to mark test methods.

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
[System.Runtime.CompilerServices.Nullable(0)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
public sealed class TestMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)>]
type TestMethodAttribute = class
 inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type TestMethodAttribute = class
 inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type TestMethodAttribute = class
 inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
type TestMethodAttribute = class
 inherit Attribute
Public Class TestMethodAttribute
Inherits Attribute
Public NotInheritable Class TestMethodAttribute
Inherits Attribute
Inheritance
TestMethodAttribute
Derived
Attributes

Remarks

Constructors

Name Description
TestMethodAttribute()

Initializes a new instance of the TestMethodAttribute class.

TestMethodAttribute(String, Int32)

Initializes a new instance of the TestMethodAttribute class.

TestMethodAttribute(String)

Initializes a new instance of the TestMethodAttribute class.

Properties

Name Description
DeclaringFilePath

Gets the file path that declares the attribute.

DeclaringLineNumber

Gets the line number within DeclaringFilePath that declares the attribute.

DisplayName

Gets or sets display name for the test.

UnfoldingStrategy

Gets or sets the strategy for unfolding parameterized tests.

Methods

Name Description
Execute(ITestMethod)

Executes a test method.

ExecuteAsync(ITestMethod)

Executes a test method.

Applies to


Feedback

Was this page helpful?