Package junit.runner
Class BaseTestRunner
java.lang.Object
junit.runner.BaseTestRunner
- All Implemented Interfaces:
TestListener
- Direct Known Subclasses:
TestRunner,TestRunner,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 TypeMethodDescriptionvoidAn error occurred.voidaddFailure(Test test, AssertionFailedError t) 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 stylestatic StringgetFilteredTrace(String stack) Filters stack frames from internal JUnit classesstatic StringReturns a filtered stack traceReturns the loader to be used.static StringgetPreference(String key) static intgetPreference(String key, int dflt) protected static PropertiesReturns the Test corresponding to the given suite.static booleaninMac()static booleaninVAJava()protected ClassloadSuiteClass(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 nullprotected 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 t) abstract voidtestStarted(String testName) static StringTruncates 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: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. -
getLoader
Returns the loader to be used. -
useReloadingTestSuiteLoader
protected boolean useReloadingTestSuiteLoader() -
getPreference
-
getPreference
-
inVAJava
public static boolean inVAJava() -
inMac
public static boolean inMac() -
getFilteredTrace
Returns a filtered stack trace -
getFilteredTrace
Filters stack frames from internal JUnit classes -
showStackRaw
protected static boolean showStackRaw()
-