BaseTestRunner
public
abstract
class
BaseTestRunner
extends Object
implements
TestListener
Base class for all test runners.
This class was born live on stage in Sardinia during XP2000.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long millis, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long millis)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
|
Constants
SUITE_METHODNAME
public static final String SUITE_METHODNAME
Constant Value:
"suite"
Public constructors
BaseTestRunner
public BaseTestRunner ()
Public methods
addError
public void addError (Test test,
Throwable t)
An error occurred.
Parameters |
test |
Test |
t |
Throwable |
addFailure
public void addFailure (Test test,
AssertionFailedError t)
A failure occurred.
Parameters |
test |
Test |
t |
AssertionFailedError |
elapsedTimeAsString
public String elapsedTimeAsString (long runTime)
Returns the formatted string of the elapsed time.
endTest
public void endTest (Test test)
A test ended.
public String extractClassName (String className)
Extract the class name from a String in VA/Java style
Parameters |
className |
String |
getFilteredTrace
public static String getFilteredTrace (String stack)
Filters stack frames from internal JUnit classes
getFilteredTrace
public static String getFilteredTrace (Throwable t)
Returns a filtered stack trace
getLoader
public TestSuiteLoader getLoader ()
This method was deprecated
in API level 16.
not present in JUnit4.10
Returns the loader to be used.
getPreference
public static int getPreference (String key,
int dflt)
Parameters |
key |
String |
dflt |
int |
getPreference
public static String getPreference (String key)
getTest
public Test getTest (String suiteClassName)
Returns the Test corresponding to the given suite. This is
a template method, subclasses override runFailed(), clearStatus().
Parameters |
suiteClassName |
String |
inVAJava
public static boolean inVAJava ()
This method was deprecated
in API level 16.
not present in JUnit4.10
savePreferences
public static void savePreferences ()
setLoading
public void setLoading (boolean enable)
Sets the loading behaviour of the test runner
Parameters |
enable |
boolean |
setPreference
public void setPreference (String key,
String value)
Parameters |
key |
String |
value |
String |
startTest
public void startTest (Test test)
A test started.
testEnded
public abstract void testEnded (String testName)
Parameters |
testName |
String |
testFailed
public abstract void testFailed (int status,
Test test,
Throwable t)
Parameters |
status |
int |
test |
Test |
t |
Throwable |
testStarted
public abstract void testStarted (String testName)
Parameters |
testName |
String |
truncate
public static String truncate (String s)
Truncates a String to the maximum length.
Protected methods
clearStatus
protected void clearStatus ()
Clears the status message.
getPreferences
protected static Properties getPreferences ()
loadSuiteClass
protected Class<?> loadSuiteClass (String suiteClassName)
Returns the loaded Class for a suite name.
Parameters |
suiteClassName |
String |
processArguments
protected String processArguments (String[] args)
Processes the command line arguments and
returns the name of the suite class to run or null
runFailed
protected abstract void runFailed (String message)
Override to define how to handle a failed loading of
a test suite.
Parameters |
message |
String |
setPreferences
protected static void setPreferences (Properties preferences)
Parameters |
preferences |
Properties |
showStackRaw
protected static boolean showStackRaw ()
useReloadingTestSuiteLoader
protected boolean useReloadingTestSuiteLoader ()