Package diva.util.jester
Class TestSuite
- java.lang.Object
-
- 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:- A single constructor that takes a test harness and one or factories as arguments
- Implementations of the runSuite() and run() methods.
- Subclasses of TestCase for use in the tests (optional)
- One or more Factory classes (*)
- A main() method for running just this test suite (*)
- Public methods that implement tests, with names starting with "test."
- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description TestSuite()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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:- Create an instance of the unit test suite of each superclass and implemented interface, and call its runSuite() method.
- Call its own runSuite() method.
-
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 togetTestHarness().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.
-
-