IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
The TestResult class represents the result of a test. More...
Public Member Functions | |
TestResult (ITest test) | |
Construct a test result given a Test More... | |
TNode | ToXml (bool recursive) |
Returns the Xml representation of the result. More... | |
virtual TNode | AddToXml (TNode parentNode, bool recursive) |
Adds the XML representation of the result as a child of the supplied parent node.. More... | |
virtual void | AddResult (ITestResult result) |
Adds a child result to this result, setting this result's ResultState to Failure if the child result failed. More... | |
void | SetResult (ResultState resultState) |
Set the result of the test More... | |
void | SetResult (ResultState resultState, string message) |
Set the result of the test More... | |
void | SetResult (ResultState resultState, string message, string stackTrace) |
Set the result of the test More... | |
void | RecordException (Exception ex) |
Set the test result based on the type of exception thrown More... | |
void | RecordException (Exception ex, FailureSite site) |
Set the test result based on the type of exception thrown More... | |
void | RecordTearDownException (Exception ex) |
RecordTearDownException appends the message and stacktrace from an exception arising during teardown of the test to any previously recorded information, so that any earlier failure information is not lost. Note that calling Assert.Ignore, Assert.Inconclusive, etc. during teardown is treated as an error. If the current result represents a suite, it may show a teardown error even though all contained tests passed. More... | |
Properties | |
ITest | Test [get, private set] |
Gets the test with which this result is associated. More... | |
ResultState | ResultState [get, private set] |
Gets the ResultState of the test result, which indicates the success or failure of the test. More... | |
virtual string | Name [get] |
Gets the name of the test result More... | |
virtual string | FullName [get] |
Gets the full name of the test result More... | |
double | Duration [get, set] |
Gets or sets the elapsed time for running the test in seconds More... | |
DateTime | StartTime [get, set] |
Gets or sets the time the test started running. More... | |
DateTime | EndTime [get, set] |
Gets or sets the time the test finished running. More... | |
string | Message [get, private set] |
Gets the message associated with a test failure or with not running the test More... | |
virtual string | StackTrace [get, private set] |
Gets any stacktrace associated with an error or failure. More... | |
int | AssertCount [get, set] |
Gets or sets the count of asserts executed when running the test. More... | |
abstract int | FailCount [get] |
Gets the number of test cases that failed when running the test and all its children. More... | |
abstract int | PassCount [get] |
Gets the number of test cases that passed when running the test and all its children. More... | |
abstract int | SkipCount [get] |
Gets the number of test cases that were skipped when running the test and all its children. More... | |
abstract int | InconclusiveCount [get] |
Gets the number of test cases that were inconclusive when running the test and all its children. More... | |
bool | HasChildren [get] |
Indicates whether this result has any child results. Test HasChildren before accessing Children to avoid the creation of an empty collection. More... | |
System.Collections.Generic.IList < ITestResult > | Children [get] |
Gets the collection of child results. More... | |
StringWriter | OutWriter [get] |
Gets a TextWriter, which will write output to be included in the result. More... | |
string | Output [get] |
Gets any text output written to this result. More... | |
![]() | |
ResultState | ResultState [get] |
Gets the ResultState of the test result, which indicates the success or failure of the test. More... | |
string | Name [get] |
Gets the name of the test result More... | |
string | FullName [get] |
Gets the full name of the test result More... | |
double | Duration [get] |
Gets the elapsed time for running the test in seconds More... | |
DateTime | StartTime [get] |
Gets or sets the time the test started running. More... | |
DateTime | EndTime [get] |
Gets or sets the time the test finished running. More... | |
string | Message [get] |
Gets the message associated with a test failure or with not running the test More... | |
string | StackTrace [get] |
Gets any stacktrace associated with an error or failure. Not available in the Compact Framework 1.0. More... | |
int | AssertCount [get] |
Gets the number of asserts executed when running the test and all its children. More... | |
int | FailCount [get] |
Gets the number of test cases that failed when running the test and all its children. More... | |
int | PassCount [get] |
Gets the number of test cases that passed when running the test and all its children. More... | |
int | SkipCount [get] |
Gets the number of test cases that were skipped when running the test and all its children. More... | |
int | InconclusiveCount [get] |
Gets the number of test cases that were inconclusive when running the test and all its children. More... | |
bool | HasChildren [get] |
Indicates whether this result has any child results. Accessing HasChildren should not force creation of the Children collection in classes implementing this interface. More... | |
System.Collections.Generic.IList < ITestResult > | Children [get] |
Gets the the collection of child results. More... | |
ITest | Test [get] |
Gets the Test to which this result applies. More... | |
string | Output [get] |
Gets any text output written to this result. More... | |
Private Member Functions | |
TNode | AddReasonElement (TNode targetNode) |
Adds a reason element to a node and returns it. More... | |
TNode | AddFailureElement (TNode targetNode) |
Adds a failure element to a node and returns it. More... | |
TNode | AddOutputElement (TNode targetNode) |
Private Attributes | |
System.Collections.Generic.List < ITestResult > | _children |
List of child results More... | |
StringWriter | _outWriter |
double | _duration |
The TestResult class represents the result of a test.
|
inline |
Construct a test result given a Test
test | The test to be used |
References NUnit.Framework.Interfaces.ResultState.Inconclusive.
|
inline |
Returns the Xml representation of the result.
recursive | If true, descendant results are included |
Implements NUnit.Framework.Interfaces.IXmlNodeBuilder.
Referenced by NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_Multiple_XmlOutput(), NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_XmlOutput(), NUnit.Framework.Internal.TestResultOutputTests.IfNothingIsWritten_XmlOutputIsEmpty(), NUnit.Framework.Internal.TestResultTests.SuiteResultXmlNodeBasicInfo(), and NUnit.Framework.Internal.TestResultTests.TestResultXmlNodeBasicInfo().
|
inlinevirtual |
Adds the XML representation of the result as a child of the supplied parent node..
parentNode | The parent node. |
recursive | If true, descendant results are included |
Implements NUnit.Framework.Interfaces.IXmlNodeBuilder.
References NUnit.Framework.Interfaces.TNode.AddAttribute(), NUnit.Framework.Internal.TestResult.AddToXml(), NUnit.Framework.Children, NUnit.Framework.Interfaces.ResultState.Label, NUnit.Framework.Interfaces.ResultState.Site, and NUnit.Framework.Interfaces.ResultState.Status.
Referenced by NUnit.Framework.Internal.TestResult.AddToXml().
|
inlinevirtual |
Adds a child result to this result, setting this result's ResultState to Failure if the child result failed.
result | The result to be added |
Reimplemented in NUnit.Framework.Internal.TestSuiteResult.
References NUnit.Framework.Interfaces.ResultState.Cancelled, NUnit.Framework.Interfaces.ResultState.ChildFailure, NUnit.Framework.Children, NUnit.Framework.Interfaces.ResultState.Ignored, NUnit.Framework.Interfaces.ResultState.Label, NUnit.Framework.Interfaces.ITestResult.ResultState, NUnit.Framework.Interfaces.ResultState.Status, and NUnit.Framework.Interfaces.ResultState.Success.
|
inline |
Set the result of the test
resultState | The ResultState to use in the result |
Referenced by NUnit.Framework.Internal.Commands.TheoryResultCommand.Execute(), NUnit.Framework.Internal.Commands.SkipCommand.Execute(), NUnit.Framework.Internal.Commands.MaxTimeCommand.Execute(), NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(), NUnit.Framework.Attributes.Tests.CommandWrapperTests.ExpectedExceptionAttribute.ExpectedExceptionCommand.Execute(), NUnit.Framework.Internal.Execution.CompositeWorkItem.SkipChildren(), NUnitLite.Tests.TeamCityEventListenerTests.TestFinished_Failed(), NUnitLite.Tests.TeamCityEventListenerTests.TestFinished_Ignored(), NUnitLite.Tests.TeamCityEventListenerTests.TestFinished_Inconclusive(), and NUnitLite.Tests.TeamCityEventListenerTests.TestFinished_Passed().
|
inline |
Set the result of the test
resultState | The ResultState to use in the result |
message | A message associated with the result state |
|
inline |
Set the result of the test
resultState | The ResultState to use in the result |
message | A message associated with the result state |
stackTrace | Stack trace giving the location of the command |
|
inline |
Set the test result based on the type of exception thrown
ex | The exception that was thrown |
References NUnit.Framework.Internal.ExceptionHelper.BuildMessage(), NUnit.Framework.Internal.ExceptionHelper.BuildStackTrace(), and NUnit.Framework.Internal.StackFilter.Filter().
Referenced by NUnit.Framework.Internal.Commands.ApplyChangesToContextCommand.Execute(), NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute(), and NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformOneTimeSetUp().
|
inline |
Set the test result based on the type of exception thrown
ex | The exception that was thrown |
site | THe FailureSite to use in the result |
References NUnit.Framework.Internal.ExceptionHelper.BuildMessage(), NUnit.Framework.Internal.ExceptionHelper.BuildStackTrace(), NUnit.Framework.Interfaces.ResultState.Cancelled, NUnit.Framework.Interfaces.ResultState.Error, NUnit.Framework.Internal.StackFilter.Filter(), and NUnit.Framework.Interfaces.ResultState.WithSite().
|
inline |
RecordTearDownException appends the message and stacktrace from an exception arising during teardown of the test to any previously recorded information, so that any earlier failure information is not lost. Note that calling Assert.Ignore, Assert.Inconclusive, etc. during teardown is treated as an error. If the current result represents a suite, it may show a teardown error even though all contained tests passed.
ex | The Exception to be recorded |
References NUnit.Framework.Internal.ExceptionHelper.BuildMessage(), NUnit.Framework.Internal.ExceptionHelper.BuildStackTrace(), NUnit.Framework.Interfaces.ResultState.Cancelled, NUnit.Framework.Interfaces.ResultState.Error, NUnit.Env.NewLine, and NUnit.Framework.Interfaces.ResultState.WithSite().
Referenced by NUnit.Framework.Internal.Commands.OneTimeTearDownCommand.Execute(), and NUnit.Framework.Internal.Commands.SetUpTearDownItem.RunTearDown().
Adds a reason element to a node and returns it.
targetNode | The target node. |
References NUnit.Framework.Interfaces.TNode.AddElement(), and NUnit.Framework.Interfaces.TNode.AddElementWithCDATA().
Adds a failure element to a node and returns it.
targetNode | The target node. |
References NUnit.Framework.Interfaces.TNode.AddElement(), and NUnit.Framework.Interfaces.TNode.AddElementWithCDATA().
|
private |
List of child results
|
private |
|
private |
|
getprivate set |
Gets the test with which this result is associated.
|
getprivate set |
Gets the ResultState of the test result, which indicates the success or failure of the test.
Referenced by NUnit.Framework.Internal.Commands.TheoryResultCommand.Execute(), NUnit.Framework.Internal.Commands.MaxTimeCommand.Execute(), NUnit.Framework.RetryAttribute.RetryCommand.Execute(), NUnit.Framework.RepeatAttribute.RepeatedTestCommand.Execute(), NUnit.Framework.Internal.SetUpTearDownTests.HandleExceptionInSetUp(), NUnit.Framework.Assertions.AssertIgnoreTests.IgnoreWorksFromSetUp(), and NUnit.Framework.Internal.Execution.CompositeWorkItem.OnChildCompleted().
|
get |
|
get |
Gets the full name of the test result
Referenced by NUnit.Framework.Internal.TestResultTests.SuiteResultBasicInfo(), and NUnit.Framework.Internal.TestResultTests.TestResultBasicInfo().
|
getset |
Gets or sets the elapsed time for running the test in seconds
Referenced by NUnitLite.Tests.TextUITests.CreateResult(), and NUnit.Framework.Internal.Commands.MaxTimeCommand.Execute().
|
getset |
Gets or sets the time the test started running.
Referenced by NUnitLite.Tests.TextUITests.CreateResult().
|
getset |
Gets or sets the time the test finished running.
Referenced by NUnitLite.Tests.TextUITests.CreateResult().
|
getprivate set |
Gets the message associated with a test failure or with not running the test
Referenced by NUnit.Framework.Internal.SetUpTearDownTests.HandleExceptionInSetUp().
|
getprivate set |
Gets any stacktrace associated with an error or failure.
Referenced by NUnit.Framework.Internal.SetUpTearDownTests.HandleExceptionInSetUp().
|
getset |
Gets or sets the count of asserts executed when running the test.
Referenced by NUnit.Framework.Assertions.AssertThatTests.AssertionsAreCountedCorrectly().
|
get |
Gets the number of test cases that failed when running the test and all its children.
|
get |
Gets the number of test cases that passed when running the test and all its children.
|
get |
Gets the number of test cases that were skipped when running the test and all its children.
|
get |
Gets the number of test cases that were inconclusive when running the test and all its children.
|
get |
Indicates whether this result has any child results. Test HasChildren before accessing Children to avoid the creation of an empty collection.
Referenced by NUnit.Framework.Internal.Commands.TheoryResultCommand.Execute(), and NUnit.TestUtilities.TestFinder.Find().
|
get |
Gets the collection of child results.
Referenced by NUnit.Framework.Assertions.AssertThatTests.AssertionsAreCountedCorrectly(), and NUnit.Framework.Internal.Commands.TheoryResultCommand.Execute().
|
get |
Gets a TextWriter, which will write output to be included in the result.
Referenced by NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult(), NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_Multiple(), NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_Multiple_XmlOutput(), NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_XmlOutput(), NUnitLite.Tests.TextUITests.TestFinished_WithOutput(), NUnit.Framework.Internal.Execution.TextCapture.Write(), and NUnit.Framework.Internal.Execution.TextCapture.WriteLine().
|
get |
Gets any text output written to this result.
Referenced by NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult(), NUnit.Framework.Internal.TestResultOutputTests.CanWriteOutputToResult_Multiple(), and NUnit.Framework.Internal.TestResultOutputTests.IfNothingIsWritten_OutputIsEmpty().