Package junit.runner
Class BaseTestRunner
java.lang.Object
junit.runner.BaseTestRunner
- All Implemented Interfaces:
TestListener
- Direct Known Subclasses:
TestRunner
Base class for all test runners.
This class was born live on stage in Sardinia during XP2000.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
An error occurred.void
addFailure
(Test test, AssertionFailedError e) A failure occurred.protected void
Clears the status message.elapsedTimeAsString
(long runTime) Returns the formatted string of the elapsed time.void
A test ended.extractClassName
(String className) Extract the class name from a String in VA/Java stylestatic String
getFilteredTrace
(String stack) Filters stack frames from internal JUnit classesstatic String
Returns a filtered stack tracestatic String
getPreference
(String key) static int
getPreference
(String key, int dflt) protected static Properties
Returns the Test corresponding to the given suite.protected Class
<?> loadSuiteClass
(String suiteClassName) Returns the loaded Class for a suite name.protected String
processArguments
(String[] args) Processes the command line arguments and returns the name of the suite class to run or nullprotected abstract void
Override to define how to handle a failed loading of a test suite.static void
void
setLoading
(boolean enable) Sets the loading behaviour of the test runnerstatic void
setPreference
(String key, String value) protected static void
setPreferences
(Properties preferences) protected static boolean
void
A test started.abstract void
abstract void
testFailed
(int status, Test test, Throwable e) abstract void
testStarted
(String testName) static String
Truncates a String to the maximum length.protected boolean
-
Field Details
-
SUITE_METHODNAME
- See Also:
-
-
Constructor Details
-
BaseTestRunner
public BaseTestRunner()
-
-
Method Details
-
startTest
Description copied from interface:TestListener
A test started.- Specified by:
startTest
in interfaceTestListener
-
setPreferences
-
getPreferences
-
savePreferences
- Throws:
IOException
-
setPreference
-
endTest
Description copied from interface:TestListener
A test ended.- Specified by:
endTest
in interfaceTestListener
-
addError
Description copied from interface:TestListener
An error occurred.- Specified by:
addError
in interfaceTestListener
-
addFailure
Description copied from interface:TestListener
A failure occurred.- Specified by:
addFailure
in interfaceTestListener
-
testStarted
-
testEnded
-
testFailed
-
getTest
Returns the Test corresponding to the given suite. This is a template method, subclasses override runFailed(), clearStatus(). -
elapsedTimeAsString
Returns the formatted string of the elapsed time. -
processArguments
Processes the command line arguments and returns the name of the suite class to run or null -
setLoading
Sets the loading behaviour of the test runner -
extractClassName
Extract the class name from a String in VA/Java style -
truncate
Truncates a String to the maximum length. -
runFailed
Override to define how to handle a failed loading of a test suite. -
loadSuiteClass
Returns the loaded Class for a suite name.- Throws:
ClassNotFoundException
-
clearStatus
Clears the status message. -
useReloadingTestSuiteLoader
-
getPreference
-
getPreference
-
getFilteredTrace
Returns a filtered stack trace -
getFilteredTrace
Filters stack frames from internal JUnit classes -
showStackRaw
-