org.apache.cactus.internal.server.runner
Class XMLFormatter

java.lang.Object
  extended by org.apache.cactus.internal.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 239169 2005-05-05 09:21:54Z vmassol $

Field Summary
 
Fields inherited from interface org.apache.cactus.internal.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 getEncoding()
           
 java.lang.String getSuiteClassName()
           
 java.lang.String getTotalDurationAsString()
           
 void setEncoding(java.lang.String theEncoding)
           
 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
 

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)

setEncoding

public void setEncoding(java.lang.String theEncoding)
Parameters:
theEncoding - the encoding to use for the returned XML.

getEncoding

public java.lang.String getEncoding()
Returns:
the encoding to use for the returned XML

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 © 2001-2009 The Apache Software Foundation. All Rights Reserved.