org.apache.jdo.tck.util
Class BatchTestRunner

java.lang.Object
  extended byjunit.runner.BaseTestRunner
      extended byjunit.textui.TestRunner
          extended byorg.apache.jdo.tck.util.BatchTestRunner
All Implemented Interfaces:
junit.framework.TestListener

public class BatchTestRunner
extends junit.textui.TestRunner

TestRunner class for running a single test or a test suite in batch mode. The format of the test output is specified by the result printer class. The main method sets an exit code according to the test result:

Author:
Michael Bouschen

Field Summary
static java.lang.String LOG_DIRECTORY
           
static java.lang.String RESULTPRINTER_DEFAULT
          Default of the system property ResultPrinterClass.
static java.lang.String RESULTPRINTER_PROPERTY
          Name of the system property to specify the result printer class.
 
Fields inherited from class junit.textui.TestRunner
EXCEPTION_EXIT, FAILURE_EXIT, SUCCESS_EXIT
 
Fields inherited from class junit.runner.BaseTestRunner
SUITE_METHODNAME
 
Constructor Summary
BatchTestRunner()
          Constructor.
BatchTestRunner(junit.textui.ResultPrinter resultPrinter)
          Constructor.
 
Method Summary
static java.lang.String changeFileName(java.lang.String fileName)
          Returns a file name which is constructed by values of some system properties appended by the given file name.
 junit.framework.TestResult doRun(junit.framework.Test test)
          Runs the specified test or test suite and closes the pmf.
protected  junit.textui.ResultPrinter getDefaultResultPrinter()
          Returns an instance of the default result printer class BatchResultPrinter.
static java.lang.String getFileName()
          Returns a file name which is determined by method changeFileName(String).
protected  junit.textui.ResultPrinter getResultPrinter()
          Returns a result printer instance.
protected  junit.framework.TestSuite getTestSuite(java.lang.String[] classNames)
          Returns a JUnit TestSuite instance for the classes of the specified list of class names.
static void main(java.lang.String[] args)
          Runs in batch mode and sets an exit code.
static void run(java.lang.Class clazz)
          Runs all test methods from the specified class.
static junit.framework.TestResult run(junit.framework.Test test)
          Runs the specified test or test suite
static void runAndWait(junit.framework.Test suite)
          Runs the specified test and waits until the user types RETURN.
 junit.framework.TestResult start(java.lang.String[] args)
           
 
Methods inherited from class junit.textui.TestRunner
createTestResult, doRun, getLoader, pause, 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

RESULTPRINTER_PROPERTY

public static final java.lang.String RESULTPRINTER_PROPERTY
Name of the system property to specify the result printer class.

See Also:
Constant Field Values

RESULTPRINTER_DEFAULT

public static final java.lang.String RESULTPRINTER_DEFAULT
Default of the system property ResultPrinterClass.


LOG_DIRECTORY

public static final java.lang.String LOG_DIRECTORY
Constructor Detail

BatchTestRunner

public BatchTestRunner()
Constructor. It creates a result printer instance based on the system property and delegates to the constructor taking a result printer argument.


BatchTestRunner

public BatchTestRunner(junit.textui.ResultPrinter resultPrinter)
Constructor. Uses the specified resultPrinter to format the test result.

Method Detail

run

public static void run(java.lang.Class clazz)
Runs all test methods from the specified class.


run

public static junit.framework.TestResult run(junit.framework.Test test)
Runs the specified test or test suite


runAndWait

public static void runAndWait(junit.framework.Test suite)
Runs the specified test and waits until the user types RETURN.


doRun

public junit.framework.TestResult doRun(junit.framework.Test test)
Runs the specified test or test suite and closes the pmf.


main

public static void main(java.lang.String[] args)
Runs in batch mode and sets an exit code. If the specified String array includes a single fully qualified class name, this test class is executed.


start

public junit.framework.TestResult start(java.lang.String[] args)

getTestSuite

protected junit.framework.TestSuite getTestSuite(java.lang.String[] classNames)
Returns a JUnit TestSuite instance for the classes of the specified list of class names.


getResultPrinter

protected junit.textui.ResultPrinter getResultPrinter()
Returns a result printer instance. The system property ResultPrinterClass specifies the class of the returned instanec. The class must extend junit.textui.ResultPrinter.


getDefaultResultPrinter

protected junit.textui.ResultPrinter getDefaultResultPrinter()
Returns an instance of the default result printer class BatchResultPrinter.


getFileName

public static java.lang.String getFileName()
Returns a file name which is determined by method changeFileName(String). The file name has suffix .txt.

Returns:
the file name
Throws:
java.io.IOException

changeFileName

public static java.lang.String changeFileName(java.lang.String fileName)
Returns a file name which is constructed by values of some system properties appended by the given file name. The system properties evaluated are: The returned file name is constructed as follows:
/-- Values of properties which do not exist default to "".

Parameters:
fileName - the file name
Returns:
the changed file name


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.