|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object consciouscode.seedling.tree.GenericNode consciouscode.seedling.junit.TestRunnerNode
public class TestRunnerNode
A seedling node that runs tests from "within" the seedling.
The node must have its testCase
property configured with the
name of the desired TestCase
class.
The test suite can then be run by calling runTestCase()
or
runTestCaseAndMaybeExit()
.
When a TestRunnerNode is started (via startService()
), the test
suite is started in a new thread. If the exitAfterTests
property is true (the default), the JVM exits after the tests complete with
an exit status indicating success (zero) or failure (one).
Field Summary | |
---|---|
protected static String |
EXCEPTION_RUNNING_TEST_CASE_MSG
|
Constructor Summary | |
---|---|
TestRunnerNode()
|
Method Summary | |
---|---|
junit.framework.TestResult |
getLastResult()
Gets the TestResult generated by the previous test run. |
protected Runnable |
makeRunnable()
Create a Runnable that will run the test suite. |
protected void |
runInAppropriateThread(Runnable testingRunnable)
Subclasses can override this to change the thread in which the tests are run. |
junit.framework.TestResult |
runTestCase()
Run the test case in the active thread. |
void |
runTestCaseAndMaybeExit()
Run the test case in the active thread, and then exit the JVM if the exitAfterTests property is true. |
void |
setExitAfterTests(boolean exit)
Indicate whether this TestRunner should exit the JVM after running the tests. |
void |
setTestCase(String testCase)
Specify the classname of the TestCase to run. |
void |
startService()
Run the test case. |
void |
stopService()
Stops a Seedling service. |
junit.framework.TestResult |
waitForResult()
|
Methods inherited from class consciouscode.seedling.tree.GenericNode |
---|
getLocalRoot, getLog, getNodeLocation, getNodeName, getParentBranch, isLoggingDebug, nodeInstalled, setLog, setLoggingDebug |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String EXCEPTION_RUNNING_TEST_CASE_MSG
Constructor Detail |
---|
public TestRunnerNode()
Method Detail |
---|
public void setTestCase(String testCase)
TestCase
to run.
This property has no default value.
public void setExitAfterTests(boolean exit)
public junit.framework.TestResult getLastResult()
TestResult
generated by the previous test run.
If the tests are currently running in another thread, this method will
wait for them to complete before returning.
public junit.framework.TestResult waitForResult() throws InterruptedException
InterruptedException
public junit.framework.TestResult runTestCase() throws Exception
testCase
property.
TestResult
object containing the test details.
Exception
- if the test case could not be found.public void runTestCaseAndMaybeExit()
exitAfterTests
property is true. To exit, this method
calls System.exit(int)
with an exit code of either zero (if all
tests ran successfully) or one (if any test failed).
Before calling this method, the test case class must be specified by
name via the testCase
property.
public void startService()
exitAfterTests
property is true.
startService
in interface ServiceNode
public void stopService()
ServiceNode
Implementations of this method must not do anything that may change
the state of the parent Seedling. In particular, it cannot call
any overload of the following methods:
BranchNode.getNode(java.lang.String)
,
BranchNode.getChild(java.lang.String)
, GrowingBranch.installChild(java.lang.String, java.lang.Object)
,
GrowingBranch.uninstallChild(java.lang.String)
.
Furthermore, this method may be called from within a JVM shutdown hook, which implies that it must work promptly and carefully.
stopService
in interface ServiceNode
Runtime.addShutdownHook(java.lang.Thread)
protected Runnable makeRunnable()
Runnable
that will run the test suite.
This implementation creates a Runnable that simply calls
runTestCaseAndMaybeExit()
. Subclasses may override this method
to implement different behavior.
protected void runInAppropriateThread(Runnable testingRunnable)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |