net.sf.jbenchmark
Class TestGroup

java.lang.Object
  extended bynet.sf.jbenchmark.TestFeature
      extended bynet.sf.jbenchmark.Test
          extended bynet.sf.jbenchmark.TestGroup
All Implemented Interfaces:
java.lang.Runnable, TestContext, TestListener
Direct Known Subclasses:
ChoiceTest, ForEachTest, HttpLogPlayerTest, HttpSessionTest, ParallelTestGroup, TestLoop, TestLoopDuration, TestThreadGroup, WebPageTestGroup

public class TestGroup
extends Test
implements TestContext, TestListener

A test that runs a sequence of tests.

Version:
$Id: TestGroup.java,v 1.6 2004/07/02 01:11:34 twpatkua Exp $
Author:
Adam Murdoch

Constructor Summary
TestGroup()
           
 
Method Summary
 void addListener(TestListener listener)
          Adds a listener.
 void addTest(Test test)
          Adds a test.
protected  TestResult doRun()
          Executes the test.
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of a test attribute.
 java.io.InputStream getExternalResource(java.lang.String nameOfResource)
          Delegate back to the context here.
protected  TestContext getFeatureContext()
          Returns the context to use for features of this test.
 TestListener getListener()
          Returns the listener to use to notify the container of test execution.
protected  java.util.List getTests()
          Returns the tests in this group.
 int getThreadCount()
          By default, a TestGroup has as many threads as it's containing context.
 void setAttribute(java.lang.String name, java.lang.String value)
          Sets the value of a test attribute.
 void setContext(TestContext context)
          Sets the context for this test.
 void testFailed(Test test, java.lang.Throwable throwable)
          Called when a test fails.
 void testFinished(TestResult result)
          Called when a test finishes.
 void testStart(Test test)
          Called when a test starts.
 
Methods inherited from class net.sf.jbenchmark.Test
addAssertion, addFeature, addResource, doCleanup, doInitialise, finish, getResource, run
 
Methods inherited from class net.sf.jbenchmark.TestFeature
getContext, getName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.jbenchmark.TestContext
getResource
 

Constructor Detail

TestGroup

public TestGroup()
Method Detail

setContext

public void setContext(TestContext context)
Sets the context for this test.

Overrides:
setContext in class Test

getExternalResource

public java.io.InputStream getExternalResource(java.lang.String nameOfResource)
                                        throws java.lang.Exception
Delegate back to the context here.

Specified by:
getExternalResource in interface TestContext
Throws:
java.lang.Exception

getThreadCount

public int getThreadCount()
By default, a TestGroup has as many threads as it's containing context.

Specified by:
getThreadCount in interface TestContext

addTest

public void addTest(Test test)
Adds a test.


addListener

public void addListener(TestListener listener)
Adds a listener.


getFeatureContext

protected TestContext getFeatureContext()
Returns the context to use for features of this test.

Overrides:
getFeatureContext in class Test

getTests

protected java.util.List getTests()
Returns the tests in this group.


getListener

public TestListener getListener()
Returns the listener to use to notify the container of test execution.

Specified by:
getListener in interface TestContext

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the value of a test attribute.

Specified by:
getAttribute in interface TestContext
Returns:
The value of the attribute, or null if the attribute has no value.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Sets the value of a test attribute.

Specified by:
setAttribute in interface TestContext

doRun

protected TestResult doRun()
                    throws java.lang.Exception
Executes the test.

Specified by:
doRun in class Test
Throws:
java.lang.Exception

testStart

public void testStart(Test test)
Called when a test starts.

Specified by:
testStart in interface TestListener

testFailed

public void testFailed(Test test,
                       java.lang.Throwable throwable)
Called when a test fails.

Specified by:
testFailed in interface TestListener

testFinished

public void testFinished(TestResult result)
Called when a test finishes.

Specified by:
testFinished in interface TestListener