org.apache.cactus.server.runner
Class XMLFormatter

java.lang.Object
  extended byorg.apache.cactus.server.runner.XMLFormatter
All Implemented Interfaces:
junit.framework.TestListener, XMLConstants

public class XMLFormatter
extends java.lang.Object
implements XMLConstants, junit.framework.TestListener

Format the test results in XML.

Version:
$Id: XMLFormatter.java,v 1.11 2003/01/03 15:35:45 vmassol Exp $
Author:
Vincent Massol

Field Summary
static java.lang.String[] DEFAULT_STACK_FILTER_PATTERNS
          Default stack filter patterns.
 
Fields inherited from interface org.apache.cactus.server.runner.XMLConstants
ATTR_ERRORS, ATTR_FAILURES, ATTR_MESSAGE, ATTR_NAME, ATTR_TESTS, ATTR_TIME, ATTR_TYPE, ERROR, FAILURE, TESTCASE, TESTSUITE, TESTSUITES
 
Constructor Summary
XMLFormatter()
           
 
Method Summary
 void addError(junit.framework.Test theTest, java.lang.Throwable theThrowable)
          Event called by the base test runner when the test fails with an error.
 void addFailure(junit.framework.Test theTest, junit.framework.AssertionFailedError theError)
          Event called by the base test runner when the test fails with a failure.
 void endTest(junit.framework.Test theTest)
          Event called by the base test runner when the test ends.
 java.lang.String getSuiteClassName()
           
 java.lang.String getTotalDurationAsString()
           
 void setSuiteClassName(java.lang.String theSuiteClassName)
          Sets the suite class name that was executed.
 void setTotalDuration(long theDuration)
          Sets the duration it took to execute all the tests.
 void setXslFileName(java.lang.String theXslFileName)
          Sets the XSL stylesheet file name to put in the returned XML string so that the browser will try to apply it (IE at least, I don't know about the others).
 void startTest(junit.framework.Test theTest)
          Event called by the base test runner when the test starts.
 java.lang.String toXML(junit.framework.TestResult theResult)
          Formats the test result as an XML string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STACK_FILTER_PATTERNS

public static final java.lang.String[] DEFAULT_STACK_FILTER_PATTERNS
Default stack filter patterns.

Constructor Detail

XMLFormatter

public XMLFormatter()
Method Detail

setXslFileName

public void setXslFileName(java.lang.String theXslFileName)
Sets the XSL stylesheet file name to put in the returned XML string so that the browser will try to apply it (IE at least, I don't know about the others).

Parameters:
theXslFileName - the file name (relative to the webapp root)

getSuiteClassName

public java.lang.String getSuiteClassName()
Returns:
the suite class name

setSuiteClassName

public void setSuiteClassName(java.lang.String theSuiteClassName)
Sets the suite class name that was executed.

Parameters:
theSuiteClassName - the suite class name

getTotalDurationAsString

public java.lang.String getTotalDurationAsString()
Returns:
the total duration as a string

setTotalDuration

public void setTotalDuration(long theDuration)
Sets the duration it took to execute all the tests.

Parameters:
theDuration - the time it took

toXML

public java.lang.String toXML(junit.framework.TestResult theResult)
Formats the test result as an XML string.

Parameters:
theResult - the test result object
Returns:
the XML string representation of the test results

startTest

public void startTest(junit.framework.Test theTest)
Event called by the base test runner when the test starts.

Specified by:
startTest in interface junit.framework.TestListener
Parameters:
theTest - the test object being executed

addError

public void addError(junit.framework.Test theTest,
                     java.lang.Throwable theThrowable)
Event called by the base test runner when the test fails with an error.

Specified by:
addError in interface junit.framework.TestListener
Parameters:
theTest - the test object that failed
theThrowable - the exception that was thrown

addFailure

public void addFailure(junit.framework.Test theTest,
                       junit.framework.AssertionFailedError theError)
Event called by the base test runner when the test fails with a failure.

Specified by:
addFailure in interface junit.framework.TestListener
Parameters:
theTest - the test object that failed
theError - the exception that was thrown

endTest

public void endTest(junit.framework.Test theTest)
Event called by the base test runner when the test ends.

Specified by:
endTest in interface junit.framework.TestListener
Parameters:
theTest - the test object being executed


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