⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
junit.framework

Class TestResult

Object
|
+--junit.framework.TestResult


public class TestResult
extends Object

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

Field Summary

Vector

fErrors

Vector

fFailures

A TestResult collects the results of executing a test case.

Vector

fListeners

int

fRunTests

Constructor Summary

TestResult()

Method Summary

synchronized void

addError(Test test, Throwable t)

Adds an error to the list of errors.

synchronized void

addFailure(Test test, AssertionFailedError t)

Adds a failure to the list of failures.

synchronized void

addListener(TestListener listener)

Registers a TestListener

void

endTest(Test test)

Informs the result that a test was completed.

synchronized int

errorCount()

Gets the number of detected errors.

synchronized Enumeration

errors()

Returns an Enumeration for the errors

synchronized int

failureCount()

Gets the number of detected failures.

synchronized Enumeration

failures()

Returns an Enumeration for the failures

synchronized void

removeListener(TestListener listener)

Unregisters a TestListener

void

run(final TestCase test)

Runs a TestCase.

synchronized int

runCount()

Gets the number of run tests.

void

runProtected(final Test test, Protectable p)

Runs a TestCase.

synchronized boolean

shouldStop()

Checks whether the test run should stop

void

startTest(Test test)

Informs the result that a test will be started.

synchronized void

stop()

Marks that the test run should stop.

synchronized boolean

wasSuccessful()

Returns whether the entire test was successful or not.

Field Details

fErrors

protected Vector fErrors


fFailures

protected Vector fFailures

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

fListeners

protected Vector fListeners


fRunTests

protected int fRunTests

Constructor Details

TestResult

public TestResult()

Method Details

addError

public synchronized void addError(Test test, Throwable t)

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

Parameters:
test
t

addFailure

public synchronized void addFailure(Test test, AssertionFailedError t)

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

Parameters:
test
t

addListener

public synchronized void addListener(TestListener listener)

Registers a TestListener

Parameters:
listener

endTest

public void endTest(Test test)

Informs the result that a test was completed.

Parameters:
test

errorCount

public synchronized int errorCount()

Gets the number of detected errors.


errors

public synchronized Enumeration errors()

Returns an Enumeration for the errors


failureCount

public synchronized int failureCount()

Gets the number of detected failures.


failures

public synchronized Enumeration failures()

Returns an Enumeration for the failures


removeListener

public synchronized void removeListener(TestListener listener)

Unregisters a TestListener

Parameters:
listener

run

protected void run(final TestCase test)

Runs a TestCase.

Parameters:
test

runCount

public synchronized int runCount()

Gets the number of run tests.


runProtected

public void runProtected(final Test test, Protectable p)

Runs a TestCase.

Parameters:
test
p

shouldStop

public synchronized boolean shouldStop()

Checks whether the test run should stop


startTest

public void startTest(Test test)

Informs the result that a test will be started.

Parameters:
test

stop

public synchronized void stop()

Marks that the test run should stop.


wasSuccessful

public synchronized boolean wasSuccessful()

Returns whether the entire test was successful or not.