|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner
A framework which allows for an array of tests to be run asynchronously. TestCases should reference this class in a test method.
Update for July 9, 2003: now, you can also register TestRunner instances as monitors (request 771008); these run parallel with the standard TestRunner instances, but they only quit when all of the standard TestRunner instances end.
Fixed bugs 771000 and 771001: spawned threads are now Daemon threads, and all "wild threads" (threads that just won't stop) are Thread.stop()ed.
All these changes have made this class rather fragile, as there are many threaded timing issues to deal with. Expect future refactoring with backwards compatibility.
Nested Class Summary | |
static class |
MultiThreadedTestRunner.TestDeathException
An exception that declares that the test has been stop()ed. |
Constructor Summary | |
MultiThreadedTestRunner(TestRunnable[] tr)
Create a new utility instance with the given set of parallel runners. |
|
MultiThreadedTestRunner(TestRunnable[] runners,
TestRunnable[] monitors)
Create a new utility instance with the given set of parallel runners and a set of monitors. |
Method Summary | |
void |
runTestRunnables()
Run each test given in a separate thread. |
void |
runTestRunnables(long maxTime)
Runs each test given in a separate thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiThreadedTestRunner(TestRunnable[] tr)
public MultiThreadedTestRunner(TestRunnable[] runners, TestRunnable[] monitors)
runners
- a non-null, non-empty collection of test runners.monitors
- a list of monitor runners, which may be null or
empty.Method Detail |
public void runTestRunnables() throws java.lang.Throwable
As of July 9, 2003, this method will not wait forever, but rather will wait for the internal maximum run time, which is by default 24 hours; for most unit testing scenarios, this is more than sufficient.
java.lang.Throwable
- thrown on a test run if a threaded task
throws an exception.public void runTestRunnables(long maxTime) throws java.lang.Throwable
maxTime
- the maximum amount of milliseconds to wait for
the tests to run. If the time is <= 0, then the tests
will run until they are complete. Otherwise, any threads that
don't complete by the given number of milliseconds will be killed,
and a failure will be thrown.
java.lang.Throwable
- thrown from the underlying tests if they happen
to cause an error.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |