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) booleanprivate static Propertiesstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAn error occurred.voidaddFailure(Test test, AssertionFailedError e) A failure occurred.protected voidClears the status message.elapsedTimeAsString(long runTime) Returns the formatted string of the elapsed time.voidA test ended.extractClassName(String className) Extract the class name from a String in VA/Java style(package private) static booleanfilterLine(String line) static StringgetFilteredTrace(String stack) Filters stack frames from internal JUnit classesstatic StringReturns a filtered stack tracestatic StringgetPreference(String key) static intgetPreference(String key, int dflt) protected static Propertiesprivate static FileReturns the Test corresponding to the given suite.protected Class<?> loadSuiteClass(String suiteClassName) Returns the loaded Class for a suite name.protected StringprocessArguments(String[] args) Processes the command line arguments and returns the name of the suite class to run or nullprivate static voidprotected abstract voidOverride to define how to handle a failed loading of a test suite.static voidvoidsetLoading(boolean enable) Sets the loading behaviour of the test runnerstatic voidsetPreference(String key, String value) protected static voidsetPreferences(Properties preferences) protected static booleanvoidA test started.abstract voidabstract voidtestFailed(int status, Test test, Throwable e) abstract voidtestStarted(String testName) static StringTruncates 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:TestListenerA test started.- Specified by:
startTestin interfaceTestListener
-
setPreferences
-
getPreferences
-
savePreferences
- Throws:
IOException
-
setPreference
-
endTest
Description copied from interface:TestListenerA test ended.- Specified by:
endTestin interfaceTestListener
-
addError
Description copied from interface:TestListenerAn error occurred.- Specified by:
addErrorin interfaceTestListener
-
addFailure
Description copied from interface:TestListenerA failure occurred.- Specified by:
addFailurein 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
-