org.exolab.jmscts.core
Class TestRunner

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.extensions.TestDecorator
              |
              +--junit.extensions.TestSetup
                    |
                    +--org.exolab.jmscts.core.TestRunner
All Implemented Interfaces:
JMSTest, junit.framework.Test
Direct Known Subclasses:
AbstractMessageTestRunner, ConnectionTestRunner, ProviderTestRunner, SessionTestRunner

public abstract class TestRunner
extends junit.extensions.TestSetup
implements JMSTest

This is the base class for test case runners.

Version:
$Revision: 1.4 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson

Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
TestRunner(junit.framework.Test test)
          Construct an instance with the test case to run.
 
Method Summary
 void basicRun(junit.framework.TestResult result)
          Runs the test case, by invoking runTest(junit.framework.Test, junit.framework.TestResult).
protected  void checkImplements(java.lang.Class type)
          Helper method to check that a test case or suite implements the appropriate interface.
protected  TestContext getChildContext()
          Returns the test context of child test cases
 TestContext getContext()
          Return the context to test against
 TestFilter getFilter()
          Return the test case filter
protected  junit.framework.Test[] getTests()
          Returns the test(s) as an array.
protected abstract  void runTest(junit.framework.Test test, junit.framework.TestResult result)
          Run a test case
protected  void setChildContext(TestContext context)
          Sets the test context of child test cases
 void setContext(TestContext context)
          Set the context to test against
 void setFilter(TestFilter filter)
          Set the test case filter
 boolean share()
          Returns if this test can share resources with other test cases.
protected  void tearDown()
          Cleans up after the test case has been run
 
Methods inherited from class junit.extensions.TestSetup
run, setUp
 
Methods inherited from class junit.extensions.TestDecorator
countTestCases, getTest, toString
 
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, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Constructor Detail

TestRunner

public TestRunner(junit.framework.Test test)
Construct an instance with the test case to run.
Parameters:
test - the test case to run.
Method Detail

setContext

public void setContext(TestContext context)
Set the context to test against
Specified by:
setContext in interface JMSTest
Parameters:
context - the test context

getContext

public TestContext getContext()
Return the context to test against
Specified by:
getContext in interface JMSTest
Returns:
the test context

setFilter

public void setFilter(TestFilter filter)
Set the test case filter
Parameters:
filter - the test case filter

getFilter

public TestFilter getFilter()
Return the test case filter
Returns:
the test case filter

share

public boolean share()
Returns if this test can share resources with other test cases. This implementation always returns true
Specified by:
share in interface JMSTest
Returns:
true

basicRun

public void basicRun(junit.framework.TestResult result)
Runs the test case, by invoking runTest(junit.framework.Test, junit.framework.TestResult). If TestDecorator.getTest() returns a TestSuite, then runTest(junit.framework.Test, junit.framework.TestResult) will be invoked for each contained test.
Overrides:
basicRun in class junit.extensions.TestDecorator
Parameters:
result - the instance to collect results in

runTest

protected abstract void runTest(junit.framework.Test test,
                                junit.framework.TestResult result)
Run a test case
Parameters:
test - the test case to run
result - the instance to collect results in

setChildContext

protected void setChildContext(TestContext context)
Sets the test context of child test cases
Parameters:
context - the child test case context

getChildContext

protected TestContext getChildContext()
Returns the test context of child test cases
Returns:
the child test case context

tearDown

protected void tearDown()
                 throws java.lang.Exception
Cleans up after the test case has been run
Overrides:
tearDown in class junit.extensions.TestSetup
Throws:
java.lang.Exception - for any error

checkImplements

protected void checkImplements(java.lang.Class type)
                        throws java.lang.Exception
Helper method to check that a test case or suite implements the appropriate interface.
Parameters:
type - the interface that the test must implement
Throws:
java.lang.Exception - if the test doesn't implement the required interface

getTests

protected junit.framework.Test[] getTests()
Returns the test(s) as an array. If the test is a TestSuite, the contained tests will be extracted.
Returns:
an array of the contained tests


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.