Class TestResultState
- Namespace
- Xunit
- Assembly
- xunit.v3.core.dll
Represents information about the current state of a test after it has run.
public class TestResultState
- Inheritance
-
TestResultState
- Inherited Members
Properties
ExceptionMessages
public string[]? ExceptionMessages { get; }
Property Value
- string[]
ExceptionParentIndices
Gets the parent exception index(es) for the exception(s); a -1 indicates that the exception in question has no parent. This value is only available when Result is Failed.
public int[]? ExceptionParentIndices { get; }
Property Value
- int[]
ExceptionStackTraces
public string?[]? ExceptionStackTraces { get; }
Property Value
- string[]
ExceptionTypes
Gets the fully-qualified type name(s) of the exception(s). This value is only available when Result is Failed.
public string?[]? ExceptionTypes { get; }
Property Value
- string[]
ExecutionTime
Gets the amount of time the test ran, in seconds. The value may be 0 if no
test code was run (for example, a statically skipped test). Note that the value may
be a partial value because of further timing being done while cleaning up.
public decimal? ExecutionTime { get; }
Property Value
FailureCause
Gets a value which indicates what the cause of the test failure was. This value is only available when Result is Failed.
public FailureCause? FailureCause { get; }
Property Value
Result
Returns the result from the test run.
public TestResult Result { get; }
Property Value
Methods
ForNotRun(decimal?)
Create a not run test result.
public static TestResultState ForNotRun(decimal? executionTime = null)
Parameters
executionTimedecimal?The optional execution time
Returns
ForPassed(decimal?)
Create a passing test result.
public static TestResultState ForPassed(decimal? executionTime = null)
Parameters
executionTimedecimal?The optional execution time
Returns
ForSkipped(decimal?)
Create a skipped test result.
public static TestResultState ForSkipped(decimal? executionTime = null)
Parameters
executionTimedecimal?The optional execution time
Returns
FromException(decimal, Exception?)
Creates an instance based on the presence or absence of an exception. If the exception
is null, then it will be for Passed; otherwise, it will
be for Failed;
public static TestResultState FromException(decimal executionTime, Exception? exception)
Parameters
executionTimedecimalThe time spent executing the test
exceptionExceptionThe exception, if the test failed
Returns
FromTestResult(ITestResultMessage)
Creates an instance based on inspecting the type identity of the
testResult instance.
public static TestResultState FromTestResult(ITestResultMessage testResult)
Parameters
testResultITestResultMessageThe test result