org.apache.qpid.junit.extensions
Class TestRunnerImprovedErrorHandling

java.lang.Object
  extended by junit.runner.BaseTestRunner
      extended by junit.textui.TestRunner
          extended by org.apache.qpid.junit.extensions.TestRunnerImprovedErrorHandling
All Implemented Interfaces:
junit.framework.TestListener
Direct Known Subclasses:
TKTestRunner

public class TestRunnerImprovedErrorHandling
extends junit.textui.TestRunner

The TestRunner does not provide very good error handling. It does not wrap exceptions and does not print out stack traces, losing valuable error tracing information. This class overrides methods in it in order to improve their error handling. The TKTestRunner is then built on top of this.

CRC Card
Responsibilities Collaborations


Field Summary
(package private)  org.apache.log4j.Logger log
          Used for logging.
 
Fields inherited from class junit.textui.TestRunner
EXCEPTION_EXIT, FAILURE_EXIT, SUCCESS_EXIT
 
Fields inherited from class junit.runner.BaseTestRunner
SUITE_METHODNAME
 
Constructor Summary
TestRunnerImprovedErrorHandling()
          Delegates to the super constructor.
TestRunnerImprovedErrorHandling(PrintStream printStream)
          Delegates to the super constructor.
TestRunnerImprovedErrorHandling(junit.textui.ResultPrinter resultPrinter)
          Delegates to the super constructor.
 
Method Summary
 junit.framework.TestResult start(String[] args)
          Starts a test run.
 
Methods inherited from class junit.textui.TestRunner
createTestResult, doRun, doRun, getLoader, main, pause, run, run, runAndWait, runFailed, runSingleMethod, setPrinter, testEnded, testFailed, testStarted
 
Methods inherited from class junit.runner.BaseTestRunner
addError, addFailure, clearStatus, elapsedTimeAsString, endTest, extractClassName, getFilteredTrace, getFilteredTrace, getPreference, getPreference, getPreferences, getTest, inMac, inVAJava, loadSuiteClass, processArguments, savePreferences, setLoading, setPreference, setPreferences, showStackRaw, startTest, truncate, useReloadingTestSuiteLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

org.apache.log4j.Logger log
Used for logging.

Constructor Detail

TestRunnerImprovedErrorHandling

public TestRunnerImprovedErrorHandling()
Delegates to the super constructor.


TestRunnerImprovedErrorHandling

public TestRunnerImprovedErrorHandling(PrintStream printStream)
Delegates to the super constructor.

Parameters:
printStream - The location to write test results to.

TestRunnerImprovedErrorHandling

public TestRunnerImprovedErrorHandling(junit.textui.ResultPrinter resultPrinter)
Delegates to the super constructor.

Parameters:
resultPrinter - The location to write test results to.
Method Detail

start

public junit.framework.TestResult start(String[] args)
                                 throws Exception
Starts a test run. Analyzes the command line arguments and runs the given test suite.

Overrides:
start in class junit.textui.TestRunner
Parameters:
args - The command line arguments.
Returns:
The test results.
Throws:
Exception - Any exceptions falling through the tests are wrapped in Exception and rethrown.


Licensed to the Apache Software Foundation