edu.umd.cs.mtc
Class MultithreadedTest

java.lang.Object
  extended by junit.framework.Assert
      extended by edu.umd.cs.mtc.MultithreadedTestCase
          extended by edu.umd.cs.mtc.MultithreadedTest
All Implemented Interfaces:
Test

public abstract class MultithreadedTest
extends MultithreadedTestCase
implements Test

Extends MultithreadedTestCase by implementing Test so that tests can be added to a TestSuite.

When using this class, the default behavior is to run the test once. To change this default behavior, override runTest(). For example, to run a test 20 times, override:


        public void runTest() throws Throwable {
                TestFramework.runManyTimes(this, 20);
        }
 

Since:
1.0
Author:
William Pugh, Nathaniel Ayewah
See Also:
MultithreadedTestCase, runTest()

Field Summary
 
Fields inherited from class edu.umd.cs.mtc.MultithreadedTestCase
clock, clockLock, currentTestCase, failed, lock, methodThreads, threads
 
Constructor Summary
MultithreadedTest()
           
 
Method Summary
(package private)  void addSetUpAndTearDown(TestCase tc, Method setUp, Method tearDown)
          If this MultithreadedTest is added to a test suite using TestFramework.buildTestSuite(Class), and if it is a non-static inner class of a TestCase, then the setUp and tearDown methods should be called before and after the test is run respectively.
 int countTestCases()
           
 void run(TestResult result)
           
protected  void runBare()
          Runs the bare test sequence, including setUp and tearDown if available.
 void runTest()
          This is the method that runs this test.
 
Methods inherited from class edu.umd.cs.mtc.MultithreadedTestCase
assertTick, awaitOn, finish, freezeClock, getThread, getThreadByName, getTick, getTrace, goodbye, hello, initialize, isClockFrozen, mayYield, mayYield, putThread, setTrace, skipNextWait, unfreezeClock, waitForTick, waitForTick, waitOn
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultithreadedTest

public MultithreadedTest()
Method Detail

countTestCases

public int countTestCases()
Specified by:
countTestCases in interface Test

run

public void run(TestResult result)
Specified by:
run in interface Test

runBare

protected void runBare()
                throws Throwable
Runs the bare test sequence, including setUp and tearDown if available.

Throws:
Throwable - if any exception is thrown

runTest

public void runTest()
             throws Throwable
This is the method that runs this test. It is equivalent to the testXxx methods in JUnit 3. By default the test is just run once, by calling TestFramework.runOnce(MultithreadedTestCase). To change the way the test is run, simply override this method.

Throws:
Throwable - if any exception is thrown
See Also:
TestFramework.runOnce(MultithreadedTestCase), TestFramework.runOnce(MultithreadedTestCase, Integer, Integer), TestFramework.runManyTimes(MultithreadedTestCase, int), TestFramework.runManyTimes(MultithreadedTestCase, int, Integer, Integer)

addSetUpAndTearDown

void addSetUpAndTearDown(TestCase tc,
                         Method setUp,
                         Method tearDown)
If this MultithreadedTest is added to a test suite using TestFramework.buildTestSuite(Class), and if it is a non-static inner class of a TestCase, then the setUp and tearDown methods should be called before and after the test is run respectively. This method is used by TestFramework.addSetUpAndTearDown(MultithreadedTest, TestCase) to provide the necessary references so that these methods can be invoked.

Parameters:
tc -
setUp -
tearDown -


Web Accessibility