IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Internal.TestResult Class Reference

The TestResult class represents the result of a test. More...

+ Inheritance diagram for NUnit.Framework.Internal.TestResult:
+ Collaboration diagram for NUnit.Framework.Internal.TestResult:

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...
 
- Properties inherited from NUnit.Framework.Interfaces.ITestResult
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
 

Detailed Description

The TestResult class represents the result of a test.

Constructor & Destructor Documentation

NUnit.Framework.Internal.TestResult.TestResult ( ITest  test)
inline

Construct a test result given a Test

Parameters
testThe test to be used

References NUnit.Framework.Interfaces.ResultState.Inconclusive.

Member Function Documentation

virtual TNode NUnit.Framework.Internal.TestResult.AddToXml ( TNode  parentNode,
bool  recursive 
)
inlinevirtual

Adds the XML representation of the result as a child of the supplied parent node..

Parameters
parentNodeThe parent node.
recursiveIf true, descendant results are included
Returns

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().

virtual void NUnit.Framework.Internal.TestResult.AddResult ( ITestResult  result)
inlinevirtual
void NUnit.Framework.Internal.TestResult.SetResult ( ResultState  resultState,
string  message 
)
inline

Set the result of the test

Parameters
resultStateThe ResultState to use in the result
messageA message associated with the result state
void NUnit.Framework.Internal.TestResult.SetResult ( ResultState  resultState,
string  message,
string  stackTrace 
)
inline

Set the result of the test

Parameters
resultStateThe ResultState to use in the result
messageA message associated with the result state
stackTraceStack trace giving the location of the command
void NUnit.Framework.Internal.TestResult.RecordException ( Exception  ex,
FailureSite  site 
)
inline
void NUnit.Framework.Internal.TestResult.RecordTearDownException ( Exception  ex)
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.

Parameters
exThe 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().

TNode NUnit.Framework.Internal.TestResult.AddReasonElement ( TNode  targetNode)
inlineprivate

Adds a reason element to a node and returns it.

Parameters
targetNodeThe target node.
Returns
The new reason element.

References NUnit.Framework.Interfaces.TNode.AddElement(), and NUnit.Framework.Interfaces.TNode.AddElementWithCDATA().

TNode NUnit.Framework.Internal.TestResult.AddFailureElement ( TNode  targetNode)
inlineprivate

Adds a failure element to a node and returns it.

Parameters
targetNodeThe target node.
Returns
The new failure element.

References NUnit.Framework.Interfaces.TNode.AddElement(), and NUnit.Framework.Interfaces.TNode.AddElementWithCDATA().

TNode NUnit.Framework.Internal.TestResult.AddOutputElement ( TNode  targetNode)
inlineprivate

Member Data Documentation

System.Collections.Generic.List<ITestResult> NUnit.Framework.Internal.TestResult._children
private

List of child results

StringWriter NUnit.Framework.Internal.TestResult._outWriter
private
double NUnit.Framework.Internal.TestResult._duration
private

Property Documentation

ITest NUnit.Framework.Internal.TestResult.Test
getprivate set

Gets the test with which this result is associated.

virtual string NUnit.Framework.Internal.TestResult.FullName
get
double NUnit.Framework.Internal.TestResult.Duration
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().

DateTime NUnit.Framework.Internal.TestResult.StartTime
getset

Gets or sets the time the test started running.

Referenced by NUnitLite.Tests.TextUITests.CreateResult().

DateTime NUnit.Framework.Internal.TestResult.EndTime
getset

Gets or sets the time the test finished running.

Referenced by NUnitLite.Tests.TextUITests.CreateResult().

string NUnit.Framework.Internal.TestResult.Message
getprivate set

Gets the message associated with a test failure or with not running the test

Referenced by NUnit.Framework.Internal.SetUpTearDownTests.HandleExceptionInSetUp().

virtual string NUnit.Framework.Internal.TestResult.StackTrace
getprivate set

Gets any stacktrace associated with an error or failure.

Referenced by NUnit.Framework.Internal.SetUpTearDownTests.HandleExceptionInSetUp().

int NUnit.Framework.Internal.TestResult.AssertCount
getset

Gets or sets the count of asserts executed when running the test.

Referenced by NUnit.Framework.Assertions.AssertThatTests.AssertionsAreCountedCorrectly().

abstract int NUnit.Framework.Internal.TestResult.FailCount
get

Gets the number of test cases that failed when running the test and all its children.

abstract int NUnit.Framework.Internal.TestResult.PassCount
get

Gets the number of test cases that passed when running the test and all its children.

abstract int NUnit.Framework.Internal.TestResult.SkipCount
get

Gets the number of test cases that were skipped when running the test and all its children.

abstract int NUnit.Framework.Internal.TestResult.InconclusiveCount
get

Gets the number of test cases that were inconclusive when running the test and all its children.

bool NUnit.Framework.Internal.TestResult.HasChildren
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().

System.Collections.Generic.IList<ITestResult> NUnit.Framework.Internal.TestResult.Children
get

The documentation for this class was generated from the following file: