UTF-X, Unit Testing Framework - Xslt

utfx.printers
Class ResultPrinter

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by utfx.printers.ResultPrinter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable, junit.framework.TestListener
Direct Known Subclasses:
AnsiColourResultPrinter, FormattedResultPrinter, JunitResultPrinter, XMLResultPrinter

public abstract class ResultPrinter
extends java.io.PrintStream
implements junit.framework.TestListener

Abstract result printer. Result printers are used for printing test run results. General idea based on junit.textui.ResultPrinter. In this implementation we allow for different result printers to be attached to the TestResult object and print the results of a test run in various ways.

Copyright © 2004 - University of Southern Queensland.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

$Source: /cvs/utf-x/framework/src/java/utfx/printers/ResultPrinter.java,v $

Version:
$Revision: 1.2 $ $Date: 2006/03/17 23:34:36 $ $Name: release_0_0_8_alpha $
Author:
Jacek Radajewski

Field Summary
protected  java.lang.String indentString
          indent string
protected  org.apache.log4j.Logger log
          loggin facility
private  long startTime
          start time in milliseconds
protected  int suiteDepth
          the depth of the current suite; root test suite = 0
protected  int testCaseCount
          total test case conter; first test = 1
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ResultPrinter(java.io.OutputStream os)
          Construnct a new Result Printer from an OutputStream.
 
Method Summary
 void endTest(junit.framework.Test test)
          end a test
abstract  void endTestCase(junit.framework.TestCase testCase)
          End of a test case.
abstract  void endTestSuite(junit.framework.TestSuite suite)
          End of a test suite.
 java.lang.String getIndent(int depth)
           
 void printElapsedTimeMillis()
          Print the number of milli seconds that elapsed since the start() method was called.
abstract  void printErrors(junit.framework.TestResult result)
          Print errors.
abstract  void printFailures(junit.framework.TestResult result)
          Print failures.
abstract  void printFooter(junit.framework.TestResult result)
          Print report header.
abstract  void printHeader(junit.framework.TestResult result)
          Print report header.
 void printIndent()
           
 void printSummary(junit.framework.TestResult result)
          Print the result summary.
protected  void setIndentString(java.lang.String indentString)
          Specific result printers can se the indent string to what ever they like.
 void start()
          This method is called before any test runs.
 void startTest(junit.framework.Test test)
          Start a test
abstract  void startTestCase(junit.framework.TestCase testCase)
          Start of a test case.
abstract  void startTestSuite(junit.framework.TestSuite suite)
          Start of a test suite.
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface junit.framework.TestListener
addError, addFailure
 

Field Detail

suiteDepth

protected int suiteDepth
the depth of the current suite; root test suite = 0


testCaseCount

protected int testCaseCount
total test case conter; first test = 1


indentString

protected java.lang.String indentString
indent string


startTime

private long startTime
start time in milliseconds


log

protected org.apache.log4j.Logger log
loggin facility

Constructor Detail

ResultPrinter

public ResultPrinter(java.io.OutputStream os)
Construnct a new Result Printer from an OutputStream.

Method Detail

getIndent

public java.lang.String getIndent(int depth)
Returns:
indent string

printSummary

public void printSummary(junit.framework.TestResult result)
Print the result summary. This method should be called at the end of a test run to produce a regression test summary. based on junit.textui.ResultPrinter

Parameters:
result - test result

printHeader

public abstract void printHeader(junit.framework.TestResult result)
Print report header. Based on junit.textui.ResultPrinter


printFooter

public abstract void printFooter(junit.framework.TestResult result)
Print report header. Based on junit.textui.ResultPrinter


printErrors

public abstract void printErrors(junit.framework.TestResult result)
Print errors. Based on junit.textui.ResultPrinter

Parameters:
result - test result

printFailures

public abstract void printFailures(junit.framework.TestResult result)
Print failures. Based on junit.textui.ResultPrinter

Parameters:
result - test result

startTestCase

public abstract void startTestCase(junit.framework.TestCase testCase)
Start of a test case.

Parameters:
testCase - the TestSuite we are entering.

endTestCase

public abstract void endTestCase(junit.framework.TestCase testCase)
End of a test case.

Parameters:
testCase -

startTestSuite

public abstract void startTestSuite(junit.framework.TestSuite suite)
Start of a test suite.

Parameters:
suite - the TestSuite we are entering.

endTestSuite

public abstract void endTestSuite(junit.framework.TestSuite suite)
End of a test suite.

Parameters:
suite - the test suite we are leaving

startTest

public final void startTest(junit.framework.Test test)
Start a test

Specified by:
startTest in interface junit.framework.TestListener

endTest

public final void endTest(junit.framework.Test test)
end a test

Specified by:
endTest in interface junit.framework.TestListener

start

public void start()
This method is called before any test runs.


printElapsedTimeMillis

public void printElapsedTimeMillis()
Print the number of milli seconds that elapsed since the start() method was called.


setIndentString

protected void setIndentString(java.lang.String indentString)
Specific result printers can se the indent string to what ever they like.

Parameters:
indentString - new indent string. This string will be used as a single unit of indentation. Indentation = indentString * suiteDepth.

printIndent

public void printIndent()

UTF-X, Unit Testing Framework - Xslt