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
FieldsModifier and TypeFieldDescription(package private) static boolean
(package private) static int
(package private) boolean
private static Properties
static final String
-
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 style(package private) static boolean
filterLine
(String line) static 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
private static File
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 nullprivate static void
protected 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:
-
fPreferences
-
fgMaxMessageLength
static int fgMaxMessageLength -
fgFilterStack
static boolean fgFilterStack -
fLoading
boolean fLoading
-
-
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
public void setLoading(boolean enable) 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
protected void clearStatus()Clears the status message. -
useReloadingTestSuiteLoader
protected boolean useReloadingTestSuiteLoader() -
getPreferencesFile
-
readPreferences
private static void readPreferences() -
getPreference
-
getPreference
-
getFilteredTrace
Returns a filtered stack trace -
getFilteredTrace
Filters stack frames from internal JUnit classes -
showStackRaw
protected static boolean showStackRaw() -
filterLine
-