Unit Test Frameworks

   
TestListener

Description

TestListener (see Figure B-8) is an interface used for listeners to a TestResult object. A listener may be any class that follows Test progress. Listeners are informed when a Test starts and ends, and when a Test produces a failure or error.

Figure B-8. The interface TestListener

Declaration

public interface TestListener

Constructors

None (it's an interface).

Public Methods

void addError(Test test, Throwable t)

Informs listener that Test produced an error.

void addFailure(Test test, AssertionFailedError e)

Informs listener that Test produced a failure.

void endTest(Test test)

Informs listener that Test finished.

void startTest(Test test)

Informs listener that Test is about to be run.

Protected/Private Methods

None.

Attributes

None.

Категории