diva.util.jester
Class TestSuite

java.lang.Object
  extended by diva.util.jester.TestSuite
Direct Known Subclasses:
All, All, All, BasicGraphModelTest, ConcreteFigures, FigureTest, JCanvasTest, ShapeUtilitiesTest, XMLElementTest, XMLParserTest

public abstract class TestSuite
extends java.lang.Object

The abstract superclass of test suites. A test suite runs tests on one or a set of objects. Test suites generally do not follow the class hierarchy in any way, but inherit directly from this class. Here is a brief description -- for more details and tutorial examples, see the package documentation. In order to make it possible for test suites to be run on objects of different classes -- such as subclasses or objects that implement interfaces -- all object creation should be parameterized by providing factory objects. Factory object can be a unit factory, in which case they provide (by convention) one version of the method create for each constructor, or a collaboration factory, in which case each role played in the collaboration has one or more version of a createRole method. In the case of unit factories, the factory inheritance hierarchy mimics the class hierarchy. In the case of collaboration factories, factories that create more specific classes tend should inherit from the more general factories, but the inheritance is less structured because there may be multiple subclasses. In general, a test suite contains:

The steps marked (*) are omitted if the test suite is written for an abstract class or an interface. The classes diva.jester.demo.test.UnitFoo and diva.jester.demo.test.UnitBar are examples of how to write unit tests, and serve as examples of the expected formatting of the source.

Version:
$Id: TestSuite.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie

Field Summary
private  java.lang.Object _factory
          The factory.
private  TestHarness _testHarness
          The test harness.
 
Constructor Summary
TestSuite()
           
 
Method Summary
 java.lang.Object getFactory()
          Get the factory used by this test suite.
 TestHarness getTestHarness()
          Get the test harness used by this test suite.
 void run()
          Initialize the test harness and run all the tests that can be run by this class.
 void runAll()
          Run all the tests that can be run by this class.
abstract  void runSuite()
          Run the tests defined by this test suite.
 void runTestCase(TestCase testCase)
          Run a single test case by passing it to the harness used by this test suite.
 void setFactory(java.lang.Object f)
          Set the factory used by this test suite.
 void setTestHarness(TestHarness h)
          Set the test harness used by this test suite.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_testHarness

private TestHarness _testHarness
The test harness.


_factory

private java.lang.Object _factory
The factory.

Constructor Detail

TestSuite

public TestSuite()
Method Detail

run

public final void run()
Initialize the test harness and run all the tests that can be run by this class. This final method calls runAll(), in between calling the test harness to tell it that the test suite is starting and stopping.


runAll

public void runAll()
Run all the tests that can be run by this class. By default, this method calls runSuite(), and needs to be overridden if additional test suites are to be created -- for example, to exercise methods defined in superclasses or implemented interfaces. In the case of unit tests of classes that have superclasses or implemented interfaces, the overriding method should: (Note that for this to work properly, runAll() must not call runAll() of its superclass, but must enumerate each of the test suites to be run on this object. This allows subclasses to exclude certain tests.)


runSuite

public abstract void runSuite()
Run the tests defined by this test suite. This is an abstract method, and must be overridden to execute the test methods.


runTestCase

public void runTestCase(TestCase testCase)
Run a single test case by passing it to the harness used by this test suite. This is a convenient access method, mainly intended for use by subclasses, and it equivalent to
   getTestHarness().runTestCase(testCase)
 


setTestHarness

public void setTestHarness(TestHarness h)
Set the test harness used by this test suite.


getTestHarness

public TestHarness getTestHarness()
Get the test harness used by this test suite.


setFactory

public void setFactory(java.lang.Object f)
Set the factory used by this test suite. This can be any object, but the test output will make most sense if it is an object used to produce the object or objects being tested, and that has a descriptive toString() method.


getFactory

public java.lang.Object getFactory()
Get the factory used by this test suite.