Packageasunit.framework
Classpublic class TestResult
ImplementsTestListener

A TestResult collects the results of executing a test case. It is an instance of the Collecting Parameter pattern. The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like an ArrayIndexOutOfBoundsException.

See also

Test


Protected Properties
 PropertyDefined by
  fErrors : Array
TestResult
  fFailures : Array
TestResult
  fListeners : Array
TestResult
  fRunTests : int
TestResult
Public Methods
 MethodDefined by
  
TestResult
  
addError(test:Test, t:Error):void
Adds an error to the list of errors.
TestResult
  
Adds a failure to the list of failures.
TestResult
  
addListener(listener:TestListener):void
Registers a TestListener
TestResult
  
endTest(test:Test):void
Informs the result that a test was completed.
TestResult
  
endTestMethod(test:Test, method:String):void
TestResult
  
errorCount():int
Gets the number of detected errors.
TestResult
  
errors():Array
Returns an Enumeration for the errors
TestResult
  
Gets the number of detected failures.
TestResult
  
failures():Array
Returns an Enumeration for the failures
TestResult
  
Unregisters a TestListener
TestResult
  
run(test:Test):void
Runs a TestCase.
TestResult
  
runCount():int
Gets the number of run tests.
TestResult
  
shouldStop():Boolean
Checks whether the test run should stop
TestResult
  
startTest(test:Test):void
Informs the result that a test will be started.
TestResult
  
startTestMethod(test:Test, method:String):void
TestResult
  
stop():void
Marks that the test run should stop.
TestResult
  
wasSuccessful():Boolean
Returns whether the entire test was successful or not.
TestResult
Property detail
fErrorsproperty
protected var fErrors:Array
fFailuresproperty 
protected var fFailures:Array
fListenersproperty 
protected var fListeners:Array
fRunTestsproperty 
protected var fRunTests:int
Constructor detail
TestResult()constructor
public function TestResult()
Method detail
addError()method
public function addError(test:Test, t:Error):void

Adds an error to the list of errors. The passed in exception caused the error.

Parameters
test:Test
 
t:Error
addFailure()method 
public function addFailure(test:Test, t:AssertionFailedError):void

Adds a failure to the list of failures. The passed in exception caused the failure.

Parameters
test:Test
 
t:AssertionFailedError
addListener()method 
public function addListener(listener:TestListener):void

Registers a TestListener

Parameters
listener:TestListener
endTest()method 
public function endTest(test:Test):void

Informs the result that a test was completed.

Parameters
test:Test
endTestMethod()method 
public function endTestMethod(test:Test, method:String):voidParameters
test:Test
 
method:String
errorCount()method 
public function errorCount():int

Gets the number of detected errors.

Returns
int
errors()method 
public function errors():Array

Returns an Enumeration for the errors

Returns
Array
failureCount()method 
public function failureCount():int

Gets the number of detected failures.

Returns
int
failures()method 
public function failures():Array

Returns an Enumeration for the failures

Returns
Array
removeListener()method 
public function removeListener(listener:TestListener):void

Unregisters a TestListener

Parameters
listener:TestListener
run()method 
public function run(test:Test):void

Runs a TestCase.

Parameters
test:Test
runCount()method 
public function runCount():int

Gets the number of run tests.

Returns
int
shouldStop()method 
public function shouldStop():Boolean

Checks whether the test run should stop

Returns
Boolean
startTest()method 
public function startTest(test:Test):void

Informs the result that a test will be started.

Parameters
test:Test
startTestMethod()method 
public function startTestMethod(test:Test, method:String):voidParameters
test:Test
 
method:String
stop()method 
public function stop():void

Marks that the test run should stop.

wasSuccessful()method 
public function wasSuccessful():Boolean

Returns whether the entire test was successful or not.

Returns
Boolean