public class TestRunner extends BaseTestRunner
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.
Modifier and Type | Field and Description |
---|---|
static int |
EXCEPTION_EXIT |
static int |
FAILURE_EXIT |
static int |
SUCCESS_EXIT |
SUITE_METHODNAME
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
protected TestResult |
createTestResult()
Creates the TestResult to be used for the test run.
|
TestResult |
doRun(Test test) |
TestResult |
doRun(Test suite,
boolean wait) |
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 TestResult |
run(Test test)
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 |
runSingleMethod(java.lang.String testCase,
java.lang.String method,
boolean wait) |
void |
setPrinter(ResultPrinter printer) |
TestResult |
start(java.lang.String[] args)
Starts a test run.
|
void |
testEnded(java.lang.String testName) |
void |
testFailed(int status,
Test test,
java.lang.Throwable t) |
void |
testStarted(java.lang.String testName) |
addError, addFailure, clearStatus, elapsedTimeAsString, endTest, extractClassName, getFilteredTrace, getFilteredTrace, getPreference, getPreference, getPreferences, getTest, inMac, inVAJava, loadSuiteClass, processArguments, savePreferences, setLoading, setPreference, setPreferences, showStackRaw, startTest, truncate, useReloadingTestSuiteLoader
public static final int SUCCESS_EXIT
public static final int FAILURE_EXIT
public static final int EXCEPTION_EXIT
public TestRunner()
public TestRunner(java.io.PrintStream writer)
public TestRunner(ResultPrinter printer)
public static void run(java.lang.Class testClass)
public static TestResult run(Test test)
public static void main (String[] args) { test.textui.TestRunner.run(suite()); }
public static void runAndWait(Test suite)
public TestSuiteLoader getLoader()
getLoader
in class BaseTestRunner
public void testFailed(int status, Test test, java.lang.Throwable t)
testFailed
in class BaseTestRunner
public void testStarted(java.lang.String testName)
testStarted
in class BaseTestRunner
public void testEnded(java.lang.String testName)
testEnded
in class BaseTestRunner
protected TestResult createTestResult()
public TestResult doRun(Test test)
public TestResult doRun(Test suite, boolean wait)
protected void pause(boolean wait)
public static void main(java.lang.String[] args)
public TestResult start(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
protected TestResult runSingleMethod(java.lang.String testCase, java.lang.String method, boolean wait) throws java.lang.Exception
java.lang.Exception
protected void runFailed(java.lang.String message)
BaseTestRunner
runFailed
in class BaseTestRunner
public void setPrinter(ResultPrinter printer)