⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
junit.runner

Class BaseTestRunner

java.lang.Object
|
+--junit.runner.BaseTestRunner

All Implemented Interfaces:
TestListener

Known Direct Subclasses:
TestRunner, TestRunner, TestRunner


public abstract class BaseTestRunner
extends java.lang.Object
implements TestListener

Base class for all test runners. This class was born live on stage in Sardinia during XP2000.

Field Summary

static String

SUITE_METHODNAME

Base class for all test runners.

Method Summary

synchronized void

addError(final Test test, final Throwable t)

synchronized void

addFailure(final Test test, final AssertionFailedError t)

void

clearStatus()

Clears the status message.

String

elapsedTimeAsString(long runTime)

Returns the formatted string of the elapsed time.

synchronized void

endTest(Test test)

String

extractClassName(String className)

Extract the class name from a String in VA/Java style

static String

getFilteredTrace(Throwable t)

Returns a filtered stack trace

static String

getFilteredTrace(String stack)

Filters stack frames from internal JUnit classes

TestSuiteLoader

getLoader()

Returns the loader to be used.

static String

getPreference(String key)

static int

getPreference(String key, int dflt)

static Properties

getPreferences()

Test

getTest(String suiteClassName)

Returns the Test corresponding to the given suite.

static boolean

inVAJava()

Class

loadSuiteClass(String suiteClassName)

Returns the loaded Class for a suite name.

String

processArguments(String[] args)

Processes the command line arguments and returns the name of the suite class to run or null

void

runFailed(String message)

Override to define how to handle a failed loading of a test suite.

static void

savePreferences()

void

setLoading(boolean enable)

Sets the loading behaviour of the test runner

void

setPreference(String key, String value)

static void

setPreferences(Properties preferences)

static boolean

showStackRaw()

synchronized void

startTest(Test test)

void

testEnded(String testName)

void

testFailed(int status, Test test, Throwable t)

void

testStarted(String testName)

static String

truncate(String s)

Truncates a String to the maximum length.

boolean

useReloadingTestSuiteLoader()

Field Details

SUITE_METHODNAME

public static final String SUITE_METHODNAME

Base class for all test runners. This class was born live on stage in Sardinia during XP2000.

Method Details

addError

public synchronized void addError(final Test test, final Throwable t)

Parameters:
test
t

addFailure

public synchronized void addFailure(final Test test, final AssertionFailedError t)

Parameters:
test
t

clearStatus

protected void clearStatus()

Clears the status message.


elapsedTimeAsString

public String elapsedTimeAsString(long runTime)

Returns the formatted string of the elapsed time.

Parameters:
runTime

endTest

public synchronized void endTest(Test test)

Parameters:
test

extractClassName

public String extractClassName(String className)

Extract the class name from a String in VA/Java style

Parameters:
className

getFilteredTrace

public static String getFilteredTrace(String stack)

Filters stack frames from internal JUnit classes

Parameters:
stack

getFilteredTrace

public static String getFilteredTrace(Throwable t)

Returns a filtered stack trace

Parameters:
t

getLoader

public TestSuiteLoader getLoader()

Returns the loader to be used.


getPreference

public static String getPreference(String key)

Parameters:
key

getPreference

public static int getPreference(String key, int dflt)

Parameters:
key
dflt

getPreferences

protected static Properties getPreferences()


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

inVAJava

public static boolean inVAJava()


loadSuiteClass

protected Class loadSuiteClass(String suiteClassName)

Returns the loaded Class for a suite name.

Parameters:
suiteClassName

processArguments

protected String processArguments(String[] args)

Processes the command line arguments and returns the name of the suite class to run or null

Parameters:
args

runFailed

protected void runFailed(String message)

Override to define how to handle a failed loading of a test suite.

Parameters:
message

savePreferences

public static void savePreferences()


setLoading

public void setLoading(boolean enable)

Sets the loading behaviour of the test runner

Parameters:
enable

setPreference

public void setPreference(String key, String value)

Parameters:
key
value

setPreferences

protected static void setPreferences(Properties preferences)

Parameters:
preferences

showStackRaw

protected static boolean showStackRaw()


startTest

public synchronized void startTest(Test test)

Parameters:
test

testEnded

public void testEnded(String testName)

Parameters:
testName

testFailed

public void testFailed(int status, Test test, Throwable t)

Parameters:
status
test
t

testStarted

public void testStarted(String testName)

Parameters:
testName

truncate

public static String truncate(String s)

Truncates a String to the maximum length.

Parameters:
s

useReloadingTestSuiteLoader

protected boolean useReloadingTestSuiteLoader()