Class TestFailed
Default implementation of ITestFailed.
[JsonTypeID("test-failed")]
public sealed class TestFailed : TestResultMessage, ITestFailed, ITestResultMessage, ITestMessage, ITestCaseMessage, ITestMethodMessage, ITestClassMessage, ITestCollectionMessage, ITestAssemblyMessage, IMessageSinkMessage, IJsonSerializable, IExecutionMetadata, IErrorMetadata
- Inheritance
-
TestFailed
- Implements
- Inherited Members
Properties
Cause
Gets the cause of the test failure.
public required FailureCause Cause { get; set; }
Property Value
ExceptionParentIndices
Gets the parent exception index(es) for the exception(s); a -1 indicates that the exception in question has no parent.
public required int[] ExceptionParentIndices { get; set; }
Property Value
- int[]
ExceptionTypes
Gets the fully-qualified type name(s) of the exception(s).
public required string?[] ExceptionTypes { get; set; }
Property Value
- string[]
Messages
Gets the message(s) of the exception(s).
public required string[] Messages { get; set; }
Property Value
- string[]
StackTraces
Gets the stack trace(s) of the exception(s).
public required string?[] StackTraces { get; set; }
Property Value
- string[]
Methods
FromException(Exception, string, string, string?, string?, string, string, decimal, string?, string[]?, DateTimeOffset?)
Creates a new ITestFailed constructed from an Exception object.
public static ITestFailed FromException(Exception ex, string assemblyUniqueID, string testCollectionUniqueID, string? testClassUniqueID, string? testMethodUniqueID, string testCaseUniqueID, string testUniqueID, decimal executionTime, string? output, string[]? warnings, DateTimeOffset? finishTime = null)
Parameters
exExceptionThe exception to use
assemblyUniqueIDstringThe unique ID of the assembly
testCollectionUniqueIDstringThe unique ID of the test collectioon
testClassUniqueIDstringThe (optional) unique ID of the test class
testMethodUniqueIDstringThe (optional) unique ID of the test method
testCaseUniqueIDstringThe unique ID of the test case
testUniqueIDstringThe unique ID of the test
executionTimedecimalThe execution time of the test (may be
nullif the test wasn't executed)outputstringThe (optional) output from the test
warningsstring[]The (optional) warnings that were recorded during test execution
finishTimeDateTimeOffset?The time when the test finished executing; defaults to UtcNow
Returns
Serialize(JsonObjectSerializer)
Override to serialize the values in the message into JSON.
protected override void Serialize(JsonObjectSerializer serializer)
Parameters
serializerJsonObjectSerializerThe serializer to write values to.
ToString()
public override string ToString()
Returns
ValidateObjectState(HashSet<string>)
Called before serializing the message. Implementers are expected to call ValidatePropertyIsNotNull(object?, string, HashSet<string>) for each property that must have a value, to record invalid property values into the provided hash set.
protected override void ValidateObjectState(HashSet<string> invalidProperties)