TestResult

Declared In:

Introduction

Runs test cases and collects the results.



Member Functions

addError

Registers the fact that the given test raised an error and notifies the observers.

addFailure

Registers the fact that the given test has failed and notifies the observers.

addObserver

Makes the given object an observer of TestResult.

addSkip

Registers the fact that the given test was skipped and notifies the observers.

addSuccess

Registers the fact that the given test has succeeded and notifies the observers.

assertionCount

Returns the total number of successful assertions.

errorCount

Returns the number of tests that generated an error.

failureCount

Returns the number of failed tests.

hasPassed

Returns true if and only if the test suite completes successfully, that is, without errors or failures.

notify

Sends the given event to all the observers.

passCount

Returns the number of successful tests.

runCount

Returns the number of tests run.

runSeconds

Returns the time spent to run the test suite, in seconds.

runTest

Runs the given test case or test suite.

skipCount

Returns the number of skipped test.

startTest

Sets the start time of the test and notifies the observers.

startTestCase

Notifies the observers that the given test has started.

stopTest

Sets the end time of the test and notifies the observers.

visitTestCase

Runs a test case and collects results.


addError


Registers the fact that the given test raised an error and notifies the observers.

on addError(
    aTestCase,
    message)
Parameters
aTestCase

[script] A test case.

message

[text] The message to be shown to the user.


addFailure


Registers the fact that the given test has failed and notifies the observers.

on addFailure(
    aTestCase,
    message)
Parameters
aTestCase

[script] A test case.

message

[text] The message to be shown to the user.


addObserver


Makes the given object an observer of TestResult.

on addObserver(
    anObject)
Parameters
anObject

[script] The observer.

Discussion

Observers of TestResult are sent notifications whenever certain events occur, like starting a test, completing a test, etc An observer should be an object that inherits from Observer, or at least conforms to its interface.


addSkip


Registers the fact that the given test was skipped and notifies the observers.

on addSkip(
    aTestCase,
    message)
Parameters
aTestCase

[script] A test case.

message

[text] The message to be shown to the user.


addSuccess


Registers the fact that the given test has succeeded and notifies the observers.

on addSuccess(
    aTestCase)
Parameters
aTestCase

[script] A test case.


assertionCount


Returns the total number of successful assertions.


errorCount


Returns the number of tests that generated an error.

on errorCount()

failureCount


Returns the number of failed tests.


hasPassed


Returns true if and only if the test suite completes successfully, that is, without errors or failures.

on hasPassed()

notify


Sends the given event to all the observers.

on notify(
    anEvent)
Parameters
anEvent

[record] the event that must be sent to the observers. An event contains two fields: the name of the event and the test object.


passCount


Returns the number of successful tests.

on passCount()

runCount


Returns the number of tests run.

on runCount()

runSeconds


Returns the time spent to run the test suite, in seconds.

on runSeconds()

runTest


Runs the given test case or test suite.

on runTest(
    aTest)
Parameters
aTest

[script] May be a test case or a test suite.


skipCount


Returns the number of skipped test.

on skipCount()

startTest


Sets the start time of the test and notifies the observers.

on startTest()

startTestCase


Notifies the observers that the given test has started.

on startTestCase(
    aTestCase)
Parameters
aTestCase

[script] A test case.


stopTest


Sets the end time of the test and notifies the observers.

on stopTest()

visitTestCase


Runs a test case and collects results.

on visitTestCase(
    aTestCase)
Parameters
aTestCase

[script] A test case.


Member Data

observers

An observer will be notified on visiting progress.


observers


An observer will be notified on visiting progress.

property observers : {}