|
|||||||||
| Home >> All >> org >> eclipse >> jdt >> internal >> junit >> [ runner overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jdt.internal.junit.runner
Class RemoteTestRunner

java.lang.Objectorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner
- All Implemented Interfaces:
- junit.framework.TestListener
- public class RemoteTestRunner
- extends java.lang.Object
- implements junit.framework.TestListener
- extends java.lang.Object
A TestRunner that reports results via a socket connection. See MessageIds for more information about the protocl.
| Nested Class Summary | |
private class |
RemoteTestRunner.ReaderThread
Reader thread that processes messages from the client. |
private static class |
RemoteTestRunner.RerunRequest
Holder for information for a rerun request |
| Field Summary | |
private java.net.Socket |
fClientSocket
The client socket. |
private boolean |
fDebugMode
Is the debug mode enabled? |
private java.lang.String |
fHost
Host to connect to, default is the localhost |
private CustomHashtable |
fIdMap
Map to map tests to unique IDs |
private boolean |
fKeepAlive
Keep the test run server alive after a test run has finished. |
private int |
fNextId
|
private int |
fPort
Port to connect to. |
private java.io.BufferedReader |
fReader
Reader for incoming messages |
private RemoteTestRunner.ReaderThread |
fReaderThread
Thread reading from the socket |
private java.util.Vector |
fRerunRequests
Queue of rerun requests. |
private java.lang.String |
fRerunTest
|
private boolean |
fStopped
Has the server been stopped |
private java.lang.String[] |
fTestClassNames
The name of the test classes to be executed |
private java.lang.String |
fTestName
The name of the test (argument -test) |
private junit.framework.TestResult |
fTestResult
The current test result |
private java.lang.String |
fVersion
The version expected by the client |
private java.io.PrintWriter |
fWriter
Print writer for sending messages |
private static java.lang.String |
SET_UP_TEST_METHOD_NAME
|
private static java.lang.String |
SUITE_METHODNAME
|
| Constructor Summary | |
RemoteTestRunner()
|
|
| Method Summary | |
void |
addError(junit.framework.Test test,
java.lang.Throwable throwable)
An error occurred. |
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError assertionFailedError)
A failure occurred. |
private boolean |
connect()
Connect to the remote test listener. |
private int |
countTests(junit.framework.Test[] tests)
|
private junit.framework.Test |
createTest(java.lang.String testName,
java.lang.Class testClass)
|
protected void |
defaultInit(java.lang.String[] args)
Process the default arguments. |
void |
endTest(junit.framework.Test test)
A test ended. |
private java.lang.String |
escapeComma(java.lang.String s)
|
protected java.lang.ClassLoader |
getClassLoader()
The class loader to be used for loading tests. |
private java.lang.String |
getField(java.lang.Object object,
java.lang.String fieldName)
|
private junit.framework.Test |
getTest(java.lang.String suiteClassName,
java.lang.String testName)
Returns the Test corresponding to the given suite. |
private java.lang.String |
getTestId(junit.framework.Test test)
|
private java.lang.String |
getTestName(junit.framework.Test test)
|
private java.lang.String |
getTrace(java.lang.Throwable t)
Returns the stack trace for the given throwable. |
protected void |
init(java.lang.String[] args)
Parse command line arguments. |
private boolean |
isComparisonFailure(java.lang.Throwable throwable)
|
private java.lang.Class |
loadSuiteClass(java.lang.String className)
Loads the test suite class. |
static void |
main(java.lang.String[] args)
The main entry point. |
private void |
notifyTestEnded(junit.framework.Test test)
|
private void |
notifyTestFailed(junit.framework.Test test,
java.lang.String status,
java.lang.String trace)
|
private void |
notifyTestFailed2(junit.framework.Test test,
java.lang.String status,
java.lang.String trace,
java.lang.String expected,
java.lang.String actual)
|
private void |
notifyTestReran(junit.framework.TestResult result,
java.lang.String testId,
java.lang.String testClass,
java.lang.String testName)
|
private void |
notifyTestRunEnded(long elapsedTime)
|
private void |
notifyTestRunStarted(int testCount)
|
private void |
notifyTestRunStopped(long elapsedTime)
|
private void |
notifyTestStarted(junit.framework.Test test)
|
private void |
notifyTestTreeEntry(java.lang.String treeEntry)
|
private void |
readTestNames(java.lang.String testNameFile)
|
void |
rerunTest(int testId,
java.lang.String className,
java.lang.String testName)
Reruns a test as defined by the fully qualified class name and the name of the test. |
protected void |
run()
Connects to the remote ports and runs the tests. |
protected void |
runFailed(java.lang.String message)
|
private void |
runTests(java.lang.String[] testClassNames,
java.lang.String testName)
Runs a set of tests. |
private void |
sendMessage(java.lang.String msg)
|
private void |
sendTree(junit.framework.Test test)
|
private junit.framework.Test |
setupTest(java.lang.Class reloadedTestClass,
junit.framework.Test reloadedTest)
Prepare a single test to be run standalone. |
private void |
shutDown()
Shutsdown the connection to the remote test listener. |
void |
startTest(junit.framework.Test test)
A test started. |
protected void |
stop()
Stop the current test run. |
private void |
waitForReruns()
Waits for rerun requests until an explicit stop request |
private junit.framework.Test |
warning(java.lang.String message)
Returns a test which will fail and log a warning message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
SET_UP_TEST_METHOD_NAME
private static final java.lang.String SET_UP_TEST_METHOD_NAME
- See Also:
- Constant Field Values
SUITE_METHODNAME
private static final java.lang.String SUITE_METHODNAME
- See Also:
- Constant Field Values
fTestClassNames
private java.lang.String[] fTestClassNames
- The name of the test classes to be executed
fTestName
private java.lang.String fTestName
- The name of the test (argument -test)
fTestResult
private junit.framework.TestResult fTestResult
- The current test result
fVersion
private java.lang.String fVersion
- The version expected by the client
fClientSocket
private java.net.Socket fClientSocket
- The client socket.
fWriter
private java.io.PrintWriter fWriter
- Print writer for sending messages
fReader
private java.io.BufferedReader fReader
- Reader for incoming messages
fHost
private java.lang.String fHost
- Host to connect to, default is the localhost
fPort
private int fPort
- Port to connect to.
fDebugMode
private boolean fDebugMode
- Is the debug mode enabled?
fKeepAlive
private boolean fKeepAlive
- Keep the test run server alive after a test run has finished.
This allows to rerun tests.
fStopped
private boolean fStopped
- Has the server been stopped
fRerunRequests
private java.util.Vector fRerunRequests
- Queue of rerun requests.
fReaderThread
private RemoteTestRunner.ReaderThread fReaderThread
- Thread reading from the socket
fRerunTest
private java.lang.String fRerunTest
fIdMap
private CustomHashtable fIdMap
- Map to map tests to unique IDs
fNextId
private int fNextId
| Constructor Detail |
RemoteTestRunner
public RemoteTestRunner()
| Method Detail |
main
public static void main(java.lang.String[] args)
- The main entry point.
Parameters
-classnames: the name of the test suite class -testfilename: the name of a file containing classnames of test suites -test: the test method name (format classname testname) -host: the host to connect to default local host -port: the port to connect to, mandatory argument -keepalive: keep the process alive after a test run
init
protected void init(java.lang.String[] args)
- Parse command line arguments. Hook for subclasses to process
additional arguments.
getClassLoader
protected java.lang.ClassLoader getClassLoader()
- The class loader to be used for loading tests.
Subclasses may override to use another class loader.
defaultInit
protected final void defaultInit(java.lang.String[] args)
- Process the default arguments.
readTestNames
private void readTestNames(java.lang.String testNameFile) throws java.io.IOException
run
protected void run()
- Connects to the remote ports and runs the tests.
waitForReruns
private void waitForReruns()
- Waits for rerun requests until an explicit stop request
getTest
private junit.framework.Test getTest(java.lang.String suiteClassName, java.lang.String testName)
- Returns the Test corresponding to the given suite.
runFailed
protected void runFailed(java.lang.String message)
loadSuiteClass
private java.lang.Class loadSuiteClass(java.lang.String className) throws java.lang.ClassNotFoundException
- Loads the test suite class.
runTests
private void runTests(java.lang.String[] testClassNames, java.lang.String testName)
- Runs a set of tests.
countTests
private int countTests(junit.framework.Test[] tests)
rerunTest
public void rerunTest(int testId,
java.lang.String className,
java.lang.String testName)
- Reruns a test as defined by the fully qualified class name and
the name of the test.
setupTest
private junit.framework.Test setupTest(java.lang.Class reloadedTestClass, junit.framework.Test reloadedTest)
- Prepare a single test to be run standalone. If the test case class provides
a static method Test setUpTest(Test test) then this method will be invoked.
Instead of calling the test method directly the "decorated" test returned from
setUpTest will be called. The purpose of this mechanism is to enable
tests which requires a set-up to be run individually.
warning
private junit.framework.Test warning(java.lang.String message)
- Returns a test which will fail and log a warning message.
createTest
private junit.framework.Test createTest(java.lang.String testName, java.lang.Class testClass)
addError
public final void addError(junit.framework.Test test, java.lang.Throwable throwable)
- Description copied from interface:
junit.framework.TestListener - An error occurred.
- Specified by:
addErrorin interfacejunit.framework.TestListener
addFailure
public final void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError assertionFailedError)
- Description copied from interface:
junit.framework.TestListener - A failure occurred.
- Specified by:
addFailurein interfacejunit.framework.TestListener
isComparisonFailure
private boolean isComparisonFailure(java.lang.Throwable throwable)
endTest
public void endTest(junit.framework.Test test)
- Description copied from interface:
junit.framework.TestListener - A test ended.
- Specified by:
endTestin interfacejunit.framework.TestListener
startTest
public void startTest(junit.framework.Test test)
- Description copied from interface:
junit.framework.TestListener - A test started.
- Specified by:
startTestin interfacejunit.framework.TestListener
sendTree
private void sendTree(junit.framework.Test test)
escapeComma
private java.lang.String escapeComma(java.lang.String s)
getTestId
private java.lang.String getTestId(junit.framework.Test test)
getTestName
private java.lang.String getTestName(junit.framework.Test test)
getTrace
private java.lang.String getTrace(java.lang.Throwable t)
- Returns the stack trace for the given throwable.
stop
protected void stop()
- Stop the current test run.
connect
private boolean connect()
- Connect to the remote test listener.
shutDown
private void shutDown()
- Shutsdown the connection to the remote test listener.
sendMessage
private void sendMessage(java.lang.String msg)
notifyTestRunStarted
private void notifyTestRunStarted(int testCount)
notifyTestRunEnded
private void notifyTestRunEnded(long elapsedTime)
notifyTestRunStopped
private void notifyTestRunStopped(long elapsedTime)
notifyTestStarted
private void notifyTestStarted(junit.framework.Test test)
notifyTestEnded
private void notifyTestEnded(junit.framework.Test test)
notifyTestFailed
private void notifyTestFailed(junit.framework.Test test, java.lang.String status, java.lang.String trace)
notifyTestFailed2
private void notifyTestFailed2(junit.framework.Test test, java.lang.String status, java.lang.String trace, java.lang.String expected, java.lang.String actual)
notifyTestTreeEntry
private void notifyTestTreeEntry(java.lang.String treeEntry)
notifyTestReran
private void notifyTestReran(junit.framework.TestResult result, java.lang.String testId, java.lang.String testClass, java.lang.String testName)
getField
private java.lang.String getField(java.lang.Object object, java.lang.String fieldName)
|
|||||||||
| Home >> All >> org >> eclipse >> jdt >> internal >> junit >> [ runner overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner