junit.textui
Class TestRunner

java.lang.Object
  |
  +--junit.textui.TestRunner

public class TestRunner
extends java.lang.Object
implements TestListener

A command line based tool to run tests.

 java test.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.


Constructor Summary
TestRunner()
          This method was created in VisualAge.
TestRunner(java.io.PrintStream writer)
          This method was created in VisualAge.
 
Method Summary
 void addError(Test test, java.lang.Throwable t)
           
 void addFailure(Test test, java.lang.Throwable t)
           
 void endTest(Test test)
           
static void main(java.lang.String[] args)
          main entry point.
 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 users types RETURN.
 void startTest(Test test)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRunner

public TestRunner()
This method was created in VisualAge.
Parameters:
writer - java.io.PrintStream

TestRunner

public TestRunner(java.io.PrintStream writer)
This method was created in VisualAge.
Parameters:
writer - java.io.PrintStream
Method Detail

addError

public void addError(Test test,
                     java.lang.Throwable t)
Specified by:
addError in interface TestListener

addFailure

public void addFailure(Test test,
                       java.lang.Throwable t)
Specified by:
addFailure in interface TestListener

endTest

public void endTest(Test test)
Specified by:
endTest in interface TestListener

main

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

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 users types RETURN.

startTest

public void startTest(Test test)
Specified by:
startTest in interface TestListener