|
|||||||||
| Home >> All >> junit >> [ textui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
junit.textui
Class TestRunner

java.lang.Objectjunit.runner.BaseTestRunner
junit.textui.TestRunner
- All Implemented Interfaces:
- junit.framework.TestListener
- public class TestRunner
- extends junit.runner.BaseTestRunner
A command line based tool to run tests.
java junit.textui.TestRunner [-wait] TestCaseClassTestRunner 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 | |
static int |
EXCEPTION_EXIT
|
static int |
FAILURE_EXIT
|
private ResultPrinter |
fPrinter
|
static int |
SUCCESS_EXIT
|
| Fields inherited from class 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 |
|
TestRunner(ResultPrinter printer)
Constructs a TestRunner using the given ResultPrinter all the output |
|
| Method Summary | |
protected junit.framework.TestResult |
createTestResult()
Creates the TestResult to be used for the test run. |
junit.framework.TestResult |
doRun(junit.framework.Test test)
|
junit.framework.TestResult |
doRun(junit.framework.Test suite,
boolean wait)
|
junit.runner.TestSuiteLoader |
getLoader()
Always use the StandardTestSuiteLoader. |
static void |
main(java.lang.String[] args)
|
protected void |
pause(boolean wait)
|
static void |
run(java.lang.Class testClass)
Runs a suite extracted from a TestCase subclass. |
static junit.framework.TestResult |
run(junit.framework.Test test)
Runs a single test and collects its results. |
static void |
runAndWait(junit.framework.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. |
void |
setPrinter(ResultPrinter printer)
|
protected junit.framework.TestResult |
start(java.lang.String[] args)
Starts a test run. |
void |
testEnded(java.lang.String testName)
|
void |
testFailed(int status,
junit.framework.Test test,
java.lang.Throwable t)
|
void |
testStarted(java.lang.String testName)
|
| Methods inherited from class junit.runner.BaseTestRunner |
addError, addFailure, clearStatus, elapsedTimeAsString, endTest, extractClassName, getFilteredTrace, getFilteredTrace, getPreference, getPreference, getPreferences, getTest, 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 |
fPrinter
private ResultPrinter fPrinter
SUCCESS_EXIT
public static final int SUCCESS_EXIT
- See Also:
- Constant Field Values
FAILURE_EXIT
public static final int FAILURE_EXIT
- See Also:
- Constant Field Values
EXCEPTION_EXIT
public static final int EXCEPTION_EXIT
- See Also:
- Constant Field Values
| 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
TestRunner
public TestRunner(ResultPrinter printer)
- Constructs a TestRunner using the given ResultPrinter all the output
| Method Detail |
run
public static void run(java.lang.Class testClass)
- Runs a suite extracted from a TestCase subclass.
run
public static junit.framework.TestResult run(junit.framework.Test test)
- 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(junit.framework.Test suite)
- Runs a single test and waits until the user
types RETURN.
getLoader
public junit.runner.TestSuiteLoader getLoader()
- Always use the StandardTestSuiteLoader. Overridden from
BaseTestRunner.
testFailed
public void testFailed(int status,
junit.framework.Test test,
java.lang.Throwable t)
testStarted
public void testStarted(java.lang.String testName)
testEnded
public void testEnded(java.lang.String testName)
createTestResult
protected junit.framework.TestResult createTestResult()
- Creates the TestResult to be used for the test run.
doRun
public junit.framework.TestResult doRun(junit.framework.Test test)
doRun
public junit.framework.TestResult doRun(junit.framework.Test suite, boolean wait)
pause
protected void pause(boolean wait)
main
public static void main(java.lang.String[] args)
start
protected junit.framework.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.
runFailed
protected void runFailed(java.lang.String message)
- Description copied from class:
junit.runner.BaseTestRunner - Override to define how to handle a failed loading of
a test suite.
setPrinter
public void setPrinter(ResultPrinter printer)
|
|||||||||
| Home >> All >> junit >> [ textui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC