jmathlib.tools.junit.textui
Class TestRunner

java.lang.Object
  extended by jmathlib.tools.junit.runner.BaseTestRunner
      extended by jmathlib.tools.junit.textui.TestRunner
All Implemented Interfaces:
TestListener

public class TestRunner
extends BaseTestRunner

A command line based tool to run tests.

 java junit.textui.TestRunner [-wait] TestCaseClass
 
TestRunner expects the name of a TestCase class as argument. If this class defines a static suite method it will be invoked and the returned test is run. Otherwise all the methods starting with "test" having no arguments are run.

When the wait command line argument is given TestRunner waits until the users types RETURN.

TestRunner prints a trace as the tests are executed followed by a summary at the end.


Field Summary
(package private)  int fColumn
           
(package private)  java.io.PrintStream fWriter
           
 
Fields inherited from class jmathlib.tools.junit.runner.BaseTestRunner
SUITE_METHODNAME
 
Constructor Summary
TestRunner()
          Constructs a TestRunner.
TestRunner(java.io.PrintStream writer)
          Constructs a TestRunner using the given stream for all the output
 
Method Summary
 void addError(Test test, java.lang.Throwable t)
          An error occurred.
 void addFailure(Test test, AssertionFailedError t)
          A failure occurred.
protected  TestResult createTestResult()
          Creates the TestResult to be used for the test run.
 TestResult doRun(Test suite, boolean wait)
           
 void endTest(Test test)
          A test ended.
 TestSuiteLoader getLoader()
          Always use the StandardTestSuiteLoader.
static void main(java.lang.String[] args)
           
protected  void pause(boolean wait)
           
 void print(TestResult result)
          Prints failures to the standard output
 void printErrors(TestResult result)
          Prints the errors to the standard output
 void printFailures(TestResult result)
          Prints failures to the standard output
 void printHeader(TestResult result)
          Prints the header of the report
static void run(java.lang.Class testClass)
          Runs a suite extracted from a TestCase subclass.
static void run(Test suite)
          Runs a single test and collects its results.
static void runAndWait(Test suite)
          Runs a single test and waits until the user types RETURN.
protected  void runFailed(java.lang.String message)
          Override to define how to handle a failed loading of a test suite.
protected  TestResult start(java.lang.String[] args)
          Starts a test run.
 void startTest(Test test)
          A test started.
protected  java.io.PrintStream writer()
           
 
Methods inherited from class jmathlib.tools.junit.runner.BaseTestRunner
clearStatus, elapsedTimeAsString, extractClassName, filterStack, getFilteredTrace, getPreference, getPreference, getTest, inVAJava, loadSuiteClass, processArguments, setLoading, truncate, useReloadingTestSuiteLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fWriter

java.io.PrintStream fWriter

fColumn

int fColumn
Constructor Detail

TestRunner

public TestRunner()
Constructs a TestRunner.


TestRunner

public TestRunner(java.io.PrintStream writer)
Constructs a TestRunner using the given stream for all the output

Method Detail

getLoader

public TestSuiteLoader getLoader()
Always use the StandardTestSuiteLoader. Overridden from BaseTestRunner.

Overrides:
getLoader in class BaseTestRunner

addError

public void addError(Test test,
                     java.lang.Throwable t)
Description copied from interface: TestListener
An error occurred.


addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
Description copied from interface: TestListener
A failure occurred.


createTestResult

protected TestResult createTestResult()
Creates the TestResult to be used for the test run.


doRun

public TestResult doRun(Test suite,
                        boolean wait)

pause

protected void pause(boolean wait)

startTest

public void startTest(Test test)
Description copied from interface: TestListener
A test started.


endTest

public void endTest(Test test)
Description copied from interface: TestListener
A test ended.


main

public static void main(java.lang.String[] args)

print

public void print(TestResult result)
Prints failures to the standard output


printErrors

public void printErrors(TestResult result)
Prints the errors to the standard output


printFailures

public void printFailures(TestResult result)
Prints failures to the standard output


printHeader

public void printHeader(TestResult result)
Prints the header of the report


run

public static void run(java.lang.Class testClass)
Runs a suite extracted from a TestCase subclass.


run

public static void run(Test suite)
Runs a single test and collects its results. This method can be used to start a test run from your program.
 public static void main (String[] args) {
     test.textui.TestRunner.run(suite());
 }
 


runAndWait

public static void runAndWait(Test suite)
Runs a single test and waits until the user types RETURN.


start

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

Throws:
java.lang.Exception

runFailed

protected void runFailed(java.lang.String message)
Description copied from class: BaseTestRunner
Override to define how to handle a failed loading of a test suite.

Specified by:
runFailed in class BaseTestRunner

writer

protected java.io.PrintStream writer()

FOOTER

BOTTOM