Interface ITestResult
The ITestResult interface represents the result of a test.
Namespace: NUnit.Framework.Interfaces
Assembly: nunit.framework.dll
Syntax
public interface ITestResult : IXmlNodeBuilder
Properties
View SourceAssertCount
Gets the number of asserts executed when running the test and all its children.
Declaration
int AssertCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
AssertionResultCount
Gets the number of failed assertions.
Declaration
int AssertionResultCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
AssertionResults
Gets a list of AssertionResults associated with the test
Declaration
IList<AssertionResult> AssertionResults { get; }
Property Value
| Type | Description |
|---|---|
| IList<AssertionResult> |
Remarks
The return type is historic, but this is a read-only collection. Any attempts to modify it will result in a runtime exception.
Children
Gets the collection of child results.
Declaration
IEnumerable<ITestResult> Children { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ITestResult> |
CompletedCount
Gets the number of test cases that have completed when running the test and all its children.
Declaration
int CompletedCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Convenience property for
TotalCount - (SkipCount + InconclusiveCount).
Duration
Gets the elapsed time for running the test in seconds
Declaration
double Duration { get; }
Property Value
| Type | Description |
|---|---|
| double |
EndTime
Gets or sets the time the test finished running.
Declaration
DateTime EndTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
FailCount
Gets the number of test cases that failed when running the test and all its children.
Declaration
int FailCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Count reflects test cases that return with Fail(), Fail(string) as well as test cases that throw on an assertion.
FullName
Gets the full name of the test result
Declaration
string FullName { get; }
Property Value
| Type | Description |
|---|---|
| string |
HasChildren
Indicates whether this result has any child results. Accessing HasChildren should not force creation of the Children collection in classes implementing this interface.
Declaration
bool HasChildren { get; }
Property Value
| Type | Description |
|---|---|
| bool |
InconclusiveCount
Gets the number of test cases that were inconclusive when running the test and all its children.
Declaration
int InconclusiveCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Count reflects test cases that return with Inconclusive().
InitiatedCount
Gets the number of test cases that got initiated when running the test and all its children.
Declaration
int InitiatedCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Convenience property for
TotalCount - SkipCount.
Message
Gets the message associated with a test failure or with not running the test
Declaration
string Message { get; }
Property Value
| Type | Description |
|---|---|
| string |
Name
Gets the name of the test result
Declaration
string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Output
Gets any text output written to this result.
Declaration
string Output { get; }
Property Value
| Type | Description |
|---|---|
| string |
PassCount
Gets the number of test cases that passed when running the test and all its children.
Declaration
int PassCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Count reflects test cases that return with Pass(), Pass(string), Charlie(), as well as test cases that return without an assertion.
ResultState
Gets the ResultState of the test result, which indicates the success or failure of the test.
Declaration
ResultState ResultState { get; }
Property Value
| Type | Description |
|---|---|
| ResultState |
SkipCount
Gets the number of test cases that were skipped when running the test and all its children.
Declaration
int SkipCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Count reflects test cases that return with Ignore() as well as test cases marked with ExplicitAttribute, unless explicitly executed.
StackTrace
Gets any stack trace associated with an error or failure.
Declaration
string? StackTrace { get; }
Property Value
| Type | Description |
|---|---|
| string |
StartTime
Gets or sets the time the test started running.
Declaration
DateTime StartTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
Test
Gets the Test to which this result applies.
Declaration
ITest Test { get; }
Property Value
| Type | Description |
|---|---|
| ITest |
TestAttachments
Gets the collection of files attached to the test
Declaration
ICollection<TestAttachment> TestAttachments { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<TestAttachment> |
TotalCount
Gets the total number of test cases enumerated when running the test and all its children.
Declaration
int TotalCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Test cases excluded by CategoryAttribute are excluded from this count.
WarningCount
Gets the number of test cases that had warnings when running the test and all its children.
Declaration
int WarningCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Count reflects test cases that return with Warn(string).