Interface ITestCaseMetadata
Represents metadata about a test case.
public interface ITestCaseMetadata
- Extension Methods
Properties
Explicit
Gets a flag indicating whether this test case was marked as explicit or not.
bool Explicit { get; }
Property Value
SkipReason
Gets the display text for the reason a test is being skipped; if the test
is not statically skipped, returns null. (A test may be dynamically
skipped at runtime while still returning null.)
string? SkipReason { get; }
Property Value
SourceFilePath
Gets the source file name. A null value indicates that the
source file name is not known.
string? SourceFilePath { get; }
Property Value
SourceLineNumber
Gets the source file line number. A null value indicates that the
source file line number is not known.
int? SourceLineNumber { get; }
Property Value
- int?
TestCaseDisplayName
Gets the display name of the test case.
string TestCaseDisplayName { get; }
Property Value
TestClassMetadataToken
Gets the MetadataToken for the test class. If the test did not
originate in a class, will return null.
int? TestClassMetadataToken { get; }
Property Value
- int?
Remarks
This value is only populated for xUnit.net v3 or later test cases, and will return null
for v1 or v2 test cases, regardless of whether TestClassName is null.
TestClassName
Gets the full name of the class where the test is defined (i.e., FullName).
If the test did not originiate in a class, will return null.
string? TestClassName { get; }
Property Value
TestClassNamespace
Gets the namespace of the class where the test is defined. If the test did not
originate in a class, or the class it originated in does not reside in a namespace,
will return null.
string? TestClassNamespace { get; }
Property Value
TestClassSimpleName
Gets the simple name of the class where the test is defined (the class name without namespace).
If the test did not originiate in a class, will return null.
string? TestClassSimpleName { get; }
Property Value
TestMethodMetadataToken
Gets the MetadataToken for the test method. If the test did not
originate in a method, or the test framework did not provide this information, will return null.
int? TestMethodMetadataToken { get; }
Property Value
- int?
Remarks
This value is only populated for xUnit.net v3 or later test cases, and will return null
for v1 or v2 test cases, regardless of whether TestMethodName is null.
TestMethodName
Gets the method name where the test is defined, in the TestClassName class.
If the test did not originiate in a method, will return null.
string? TestMethodName { get; }
Property Value
TestMethodParameterTypesVSTest
Gets the types for the test method parameters. If the test did not originate in a method,
or the test framework does not provide this information, will return null; if the test
method has no parameters, will return an empty array.
string[]? TestMethodParameterTypesVSTest { get; }
Property Value
- string[]
Remarks
The values here are formatted according to VSTest rules in order to support Test Explorer. Note that this is not the same as FullName.
TestMethodReturnTypeVSTest
Gets the test method return type. If the test did not originate in a method, or the test framework
did not provide this information, will return null.
string? TestMethodReturnTypeVSTest { get; }
Property Value
Remarks
The value here is formatted according to VSTest rules in order to support Test Explorer. Note that this is not the same as FullName.
Traits
Gets the trait values associated with this test case. If there are none, or the framework
does not support traits, this should return an empty dictionary (not null).
IReadOnlyDictionary<string, IReadOnlyCollection<string>> Traits { get; }
Property Value
UniqueID
Gets a unique identifier for the test case.
string UniqueID { get; }
Property Value
Remarks
The unique identifier for a test case should be able to discriminate among test cases, even those which are varied invocations against the same test method (i.e., theories). This identifier should remain stable until such time as the developer changes some fundamental part of the identity (assembly, class name, test name, or test data). Recompilation of the test assembly is reasonable as a stability changing event.