org.quilt.reports
Class BaseFormatter

java.lang.Object
  |
  +--org.quilt.reports.BaseFormatter
All Implemented Interfaces:
Formatter, junit.framework.TestListener
Direct Known Subclasses:
BriefFormatter, PlainFormatter

public abstract class BaseFormatter
extends java.lang.Object
implements Formatter

Basic test result formatter for Ant/Quilt/JUnit.


Field Summary
protected  boolean filtertrace
           
protected  java.text.NumberFormat numberFormat
           
protected  java.io.OutputStream out
           
protected  java.io.PrintWriter output
           
protected  java.io.StringWriter results
           
protected  java.io.PrintWriter resultWriter
           
protected  Runner runner
           
protected  java.lang.String systemError
           
protected  java.lang.String systemOutput
           
 
Constructor Summary
BaseFormatter()
           
 
Method Summary
 void addError(junit.framework.Test test, java.lang.Throwable error)
          A test caused an unexpected error.
 void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)
          A test failed.
 void addFailure(junit.framework.Test test, java.lang.Throwable t)
          A test failed.
 void endTest(junit.framework.Test test)
          Method called at end of test.
 void endTestSuite(QuiltTest suite)
          Called at end of Quilt/JUnit test run.
static java.lang.String getTestName(junit.framework.Test test)
          Root around in a junit Test and find a getName method.
 void setFiltertrace(boolean b)
          Whether to filter Ant/Quilt/JUnit lines from stack traces.
 void setOutput(java.io.OutputStream out)
          Where to send the report output.
 void setRunner(Runner testrunner)
          Determines which test runner to use.
 void setSystemError(java.lang.String err)
          Where to send system error output.
 void setSystemOutput(java.lang.String out)
          Where to send system output.
 void startTest(junit.framework.Test test)
          Method called at beginning of test.
 void startTestSuite(QuiltTest suite)
          Called at the start of the Ant/Quilt/JUnit test run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filtertrace

protected boolean filtertrace

numberFormat

protected java.text.NumberFormat numberFormat

out

protected java.io.OutputStream out

output

protected java.io.PrintWriter output

runner

protected Runner runner

results

protected java.io.StringWriter results

resultWriter

protected java.io.PrintWriter resultWriter

systemError

protected java.lang.String systemError

systemOutput

protected java.lang.String systemOutput
Constructor Detail

BaseFormatter

public BaseFormatter()
Method Detail

getTestName

public static java.lang.String getTestName(junit.framework.Test test)
Root around in a junit Test and find a getName method. Test may be TestCase or TestSuite; in either case there will be a getName method in JUnit 3.7 or later.

Returns:
Test/suite name.

endTestSuite

public void endTestSuite(QuiltTest suite)
                  throws org.apache.tools.ant.BuildException
Called at end of Quilt/JUnit test run.

Specified by:
endTestSuite in interface Formatter
org.apache.tools.ant.BuildException

setFiltertrace

public void setFiltertrace(boolean b)
Whether to filter Ant/Quilt/JUnit lines from stack traces.

Specified by:
setFiltertrace in interface Formatter

setOutput

public void setOutput(java.io.OutputStream out)
Where to send the report output.

Specified by:
setOutput in interface Formatter

setRunner

public void setRunner(Runner testrunner)
Determines which test runner to use.

Specified by:
setRunner in interface Formatter

setSystemOutput

public void setSystemOutput(java.lang.String out)
Where to send system output.

Specified by:
setSystemOutput in interface Formatter

setSystemError

public void setSystemError(java.lang.String err)
Where to send system error output.

Specified by:
setSystemError in interface Formatter

startTestSuite

public void startTestSuite(QuiltTest suite)
                    throws org.apache.tools.ant.BuildException
Called at the start of the Ant/Quilt/JUnit test run.

Specified by:
startTestSuite in interface Formatter
org.apache.tools.ant.BuildException

addError

public void addError(junit.framework.Test test,
                     java.lang.Throwable error)
A test caused an unexpected error.

Specified by:
addError in interface junit.framework.TestListener

addFailure

public void addFailure(junit.framework.Test test,
                       java.lang.Throwable t)
A test failed.


addFailure

public void addFailure(junit.framework.Test test,
                       junit.framework.AssertionFailedError t)
A test failed.

Specified by:
addFailure in interface junit.framework.TestListener

startTest

public void startTest(junit.framework.Test test)
Method called at beginning of test.

Specified by:
startTest in interface junit.framework.TestListener
Parameters:
test - JUnit Test (TestCase or TestSuite)

endTest

public void endTest(junit.framework.Test test)
Method called at end of test.

Specified by:
endTest in interface junit.framework.TestListener
Parameters:
test - JUnit Test (TestCase or TestSuite)


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.