junit.textui
Class TestRunner
- TestListener
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.
TestRunner() - Constructs a TestRunner.
|
TestRunner(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
|
addError , addFailure , clearStatus , elapsedTimeAsString , endTest , extractClassName , getFilteredTrace , getFilteredTrace , getLoader , getPreference , getPreference , getPreferences , getTest , inVAJava , loadSuiteClass , processArguments , runFailed , savePreferences , setLoading , setPreference , setPreferences , showStackRaw , startTest , testEnded , testFailed , testStarted , truncate , useReloadingTestSuiteLoader |
EXCEPTION_EXIT
public static final int EXCEPTION_EXIT
- 2
FAILURE_EXIT
public static final int FAILURE_EXIT
- 1
SUCCESS_EXIT
public static final int SUCCESS_EXIT
- 0
TestRunner
public TestRunner()
Constructs a TestRunner.
TestRunner
public TestRunner(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
createTestResult
protected TestResult createTestResult()
Creates the TestResult to be used for the test run.
getLoader
public TestSuiteLoader getLoader()
Always use the StandardTestSuiteLoader. Overridden from
BaseTestRunner.
- getLoader in interface BaseTestRunner
main
public static void main(args[] )
pause
protected void pause(boolean wait)
run
public static void run(Class testClass)
Runs a suite extracted from a TestCase subclass.
run
public static TestResult run(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(Test suite)
Runs a single test and waits until the user
types RETURN.
runFailed
protected void runFailed(String message)
- runFailed in interface BaseTestRunner
start
protected TestResult start(args[] )
throws Exception
Starts a test run. Analyzes the command line arguments
and runs the given test suite.
testEnded
public void testEnded(String testName)
- testEnded in interface BaseTestRunner
testFailed
public void testFailed(int status,
Test test,
Throwable t)
- testFailed in interface BaseTestRunner
testStarted
public void testStarted(String testName)
- testStarted in interface BaseTestRunner