net.sourceforge.sqlunit.reporters
Class TextReporter

java.lang.Object
  extended by net.sourceforge.sqlunit.reporters.TextReporter
All Implemented Interfaces:
IReporter

public class TextReporter
extends java.lang.Object
implements IReporter

SQLUnit reporter that writes its text to standard output. This is the default reporter for SQLUnit.

Version:
$Revision: 1.6 $
Author:
Rob Nielsen (robn@asert.com.au)

Constructor Summary
TextReporter(java.lang.String outputFile)
          Constructs a new TextReporter.
 
Method Summary
 void addFailure(java.lang.Throwable th, boolean error)
          Called when an exception occured during processing.
 void echo(java.lang.String message)
          Emits a message to the reporter's outputstream.
 void finishedTest(long elapsed, boolean success)
          Called when a test is completed
 java.lang.String getName()
          Returns the name of this reporter.
 boolean hasContainer()
          Returns false since this reporter runs in SQLUnit's context.
 void newTestFile(java.lang.String testName, java.lang.String testFile)
          Called when a new sqlunit test file is run.
 void runningTest(java.lang.String name, int testIndex, java.lang.String desc)
          Called before a test is run.
 void setConfig(java.util.Map configMap)
          Called after the connection is made.
 void settingUpConnection(java.lang.String connectionId)
          Called before a database connection is setup.
 void setUp()
          Called before the set up section of the test.
 void skippedTest(java.lang.String name, int testIndex, java.lang.String desc)
          Called when a test is skipped because of an earlier failure.
 void tearDown()
          Called before the tear down section is run
 void tempFile(int testId, java.lang.String result, java.lang.String file)
          Called when a test has failed and a temporary file is left containing data.
 void testFileComplete(boolean success)
          Called when the test file has been completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextReporter

public TextReporter(java.lang.String outputFile)
Constructs a new TextReporter.

Parameters:
outputFile - the output file to write to, or null to write to standard error
Method Detail

getName

public final java.lang.String getName()
Returns the name of this reporter.

Specified by:
getName in interface IReporter
Returns:
the name of this reporter.

hasContainer

public final boolean hasContainer()
Returns false since this reporter runs in SQLUnit's context.

Specified by:
hasContainer in interface IReporter
Returns:
false.

newTestFile

public final void newTestFile(java.lang.String testName,
                              java.lang.String testFile)
Called when a new sqlunit test file is run.

Specified by:
newTestFile in interface IReporter
Parameters:
testName - the name of the test being run
testFile - the filename of the test file

settingUpConnection

public final void settingUpConnection(java.lang.String connectionId)
Called before a database connection is setup.

Specified by:
settingUpConnection in interface IReporter
Parameters:
connectionId - the id of the connection being attempted, or null for the default connection

setConfig

public final void setConfig(java.util.Map configMap)
Called after the connection is made. The map contains key/value pairs of configuration parameters for the connection and debug settings.

Specified by:
setConfig in interface IReporter
Parameters:
configMap - the configuration map

setUp

public final void setUp()
Called before the set up section of the test.

Specified by:
setUp in interface IReporter

runningTest

public final void runningTest(java.lang.String name,
                              int testIndex,
                              java.lang.String desc)
Called before a test is run.

Specified by:
runningTest in interface IReporter
Parameters:
name - the name of the test being run
testIndex - the index of the test being run
desc - a description of the test being run

finishedTest

public final void finishedTest(long elapsed,
                               boolean success)
Called when a test is completed

Specified by:
finishedTest in interface IReporter
Parameters:
elapsed - the time in milliseconds the test took to run
success - true if the test succeeded, false otherwise

skippedTest

public final void skippedTest(java.lang.String name,
                              int testIndex,
                              java.lang.String desc)
Called when a test is skipped because of an earlier failure.

Specified by:
skippedTest in interface IReporter
Parameters:
name - the name of the test being run
testIndex - the index of the test being run
desc - a description of the test being run

addFailure

public final void addFailure(java.lang.Throwable th,
                             boolean error)
Called when an exception occured during processing.

Specified by:
addFailure in interface IReporter
Parameters:
th - the exception that occured
error - true if the exception is an error, false if it is a failure

tearDown

public final void tearDown()
Called before the tear down section is run

Specified by:
tearDown in interface IReporter

tempFile

public final void tempFile(int testId,
                           java.lang.String result,
                           java.lang.String file)
Called when a test has failed and a temporary file is left containing data.

Specified by:
tempFile in interface IReporter
Parameters:
testId - the index of the test
result - the result of the test
file - the temporary file

testFileComplete

public final void testFileComplete(boolean success)
Called when the test file has been completed.

Specified by:
testFileComplete in interface IReporter
Parameters:
success - true if everything completed with no errors, false otherwise

echo

public final void echo(java.lang.String message)
Emits a message to the reporter's outputstream.

Specified by:
echo in interface IReporter
Parameters:
message - the message to print.