public class MultiThreadedTestRunner extends Object
Update for July 9, 2003: now, you can also register
TestRunnable instances as monitors (request 771008); these run
parallel with the standard TestRunnable instances, but they only
quit when all of the standard TestRunnable 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiThreadedTestRunner.TestDeathException
An exception that declares that the test has been stop()ed.
|
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
runTestRunnables()
Run each test given in a separate thread.
|
void |
runTestRunnables(long maxTime)
Runs each test given in a separate thread.
|
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.public void runTestRunnables()
throws 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.
Throwable - thrown on a test run if a threaded task
throws an exception.public void runTestRunnables(long maxTime)
throws Throwable
runnables - the list of TestCaseRunnable objects to run
asynchronouslymaxTime - 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.Throwable - thrown from the underlying tests if they happen
to cause an error.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.