Android APIs
public class

TestResult

extends Object
java.lang.Object
   ↳ junit.framework.TestResult

Class Overview

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

Summary

Fields
protected Vector<TestFailure> fErrors
protected Vector<TestFailure> fFailures
protected Vector<TestListener> fListeners
protected int fRunTests
Public Constructors
TestResult()
Public Methods
void addError(Test test, Throwable t)
Adds an error to the list of errors.
void addFailure(Test test, AssertionFailedError t)
Adds a failure to the list of failures.
void addListener(TestListener listener)
Registers a TestListener
void endTest(Test test)
Informs the result that a test was completed.
int errorCount()
Gets the number of detected errors.
Enumeration<TestFailure> errors()
Returns an Enumeration for the errors
int failureCount()
Gets the number of detected failures.
Enumeration<TestFailure> failures()
Returns an Enumeration for the failures
void removeListener(TestListener listener)
Unregisters a TestListener
int runCount()
Gets the number of run tests.
void runProtected(Test test, Protectable p)
Runs a TestCase.
boolean shouldStop()
Checks whether the test run should stop
void startTest(Test test)
Informs the result that a test will be started.
void stop()
Marks that the test run should stop.
boolean wasSuccessful()
Returns whether the entire test was successful or not.
Protected Methods
void run(TestCase test)
Runs a TestCase.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected Vector<TestFailure> fErrors

Added in API level 1

protected Vector<TestFailure> fFailures

Added in API level 1

protected Vector<TestListener> fListeners

Added in API level 1

protected int fRunTests

Added in API level 1

Public Constructors

public TestResult ()

Added in API level 1

Public Methods

public void addError (Test test, Throwable t)

Added in API level 1

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

public void addFailure (Test test, AssertionFailedError t)

Added in API level 1

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

public void addListener (TestListener listener)

Added in API level 1

Registers a TestListener

public void endTest (Test test)

Added in API level 1

Informs the result that a test was completed.

public int errorCount ()

Added in API level 1

Gets the number of detected errors.

public Enumeration<TestFailure> errors ()

Added in API level 1

Returns an Enumeration for the errors

public int failureCount ()

Added in API level 1

Gets the number of detected failures.

public Enumeration<TestFailure> failures ()

Added in API level 1

Returns an Enumeration for the failures

public void removeListener (TestListener listener)

Added in API level 1

Unregisters a TestListener

public int runCount ()

Added in API level 1

Gets the number of run tests.

public void runProtected (Test test, Protectable p)

Added in API level 1

Runs a TestCase.

public boolean shouldStop ()

Added in API level 1

Checks whether the test run should stop

public void startTest (Test test)

Added in API level 1

Informs the result that a test will be started.

public void stop ()

Added in API level 1

Marks that the test run should stop.

public boolean wasSuccessful ()

Added in API level 1

Returns whether the entire test was successful or not.

Protected Methods

protected void run (TestCase test)

Added in API level 1

Runs a TestCase.