net.groboclown.junit.v1
Class MultiThreadedTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--net.groboclown.junit.v1.MultiThreadedTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
BaseTestHttp, TestEventBus, TestEventBusEvent, TestEventBusEventObject, TestEventBusId, TestLoaderBasic, TestLoaderInclude, TestLoaderMacro, TestLocalEventDistributor, TestObjectCache, TestPathRegistry, TestSelectModule, TestSynchQueue, TestThreadedLocalEventDistributor, TestXmlObjectOutputStream

public class MultiThreadedTestCase
extends junit.framework.TestCase

A test case framework which allows for an array of tests to be run asynchronously.


Inner Class Summary
private  class MultiThreadedTestCase.StopThreadsTest
          Sends a message to
protected  class MultiThreadedTestCase.TestCaseRunnable
          Inner class which is executed in the runTestCaseRunnables method.
 
Field Summary
private  Object m_synch
           
private  junit.framework.TestResult m_testResult
          The tests TestResult
private  ThreadGroup m_threadGroup
           
private  boolean m_threadsFinished
           
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
MultiThreadedTestCase(String name)
           
 
Method Summary
private  void handleException(Throwable t)
          Handle an exception by sending them to the test results.
private  void interruptThreads()
           
 void run(junit.framework.TestResult result)
          Override run so we can save the test result
protected  void runTestCaseRunnables(MultiThreadedTestCase.TestCaseRunnable[] runnables)
          Run each test given in a separate thread.
protected  void runTestCaseRunnables(MultiThreadedTestCase.TestCaseRunnable[] runnables, long maxTime)
          Run each test given in a separate thread.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_testResult

private junit.framework.TestResult m_testResult
The tests TestResult

m_synch

private Object m_synch

m_threadsFinished

private boolean m_threadsFinished

m_threadGroup

private ThreadGroup m_threadGroup
Constructor Detail

MultiThreadedTestCase

public MultiThreadedTestCase(String name)
Method Detail

run

public void run(junit.framework.TestResult result)
Override run so we can save the test result
Overrides:
run in class junit.framework.TestCase

runTestCaseRunnables

protected void runTestCaseRunnables(MultiThreadedTestCase.TestCaseRunnable[] runnables)
Run each test given in a separate thread. Wait for each thread to finish running, then return.

runTestCaseRunnables

protected void runTestCaseRunnables(MultiThreadedTestCase.TestCaseRunnable[] runnables,
                                    long maxTime)
Run each test given in a separate thread. Wait for each thread to finish running, then return.
Parameters:
runnables - the list of TestCaseRunnable objects to run asynchronously
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

handleException

private void handleException(Throwable t)
Handle an exception by sending them to the test results.

interruptThreads

private void interruptThreads()


Written under the LGPL