Name

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.

The interface TestListener
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.

Get Unit Test Frameworks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.