ITestCollection

ITestCollection is a subclass of ITest which tests a sequence of subtests.

This class allows the test authors to group related ITest subclasses together within a single test. The tests in the collection are run sequentially to determine the success or failure of the entire group. The resulting test passes if all of its subtests pass, and fails otherwise. The subtests are always executed in a fixed order (the order in which subtests were added). The subtests can be run in random order if you call the "randomlyReorder" method after adding subtests. ITestCollection does not halt on subtest failure. It runs all the subtests by default. To change this default behavior, the "setHaltOnFail(true)" method in your setupSubtests.

Clients should derive a subclass and override setupSubtests method. In setupSubtests, clients should call "adoptTest" for each subtest.


ITestCollection - Member Functions and Data by Group

Constructors & Destructor

Class constructors and destructors.


[view class]
~ITestCollection
public:
virtual ~ITestCollection()
ITestCollection destructor does not delete the subtests of this collection. Subclasses are responsible for doing this.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ITestCollection


Overload 1
public:
ITestCollection()
Default constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
ITestCollection(const ITestCollection&)
Copy constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator =
public:
ITestCollection& operator =(const ITestCollection&)
Standard assignment operator.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Collection Test Setup

Class members used to set up the collection of tests.


[view class]
adoptTest
public:
virtual void adoptTest(ITest* subTest)
Adds the Subtest to this test's collection of subtests.

The caller must not delete the subTest after calling adopt. ITestCollection takes ownership of the subTest and will manage storage.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
propagateInputs
protected:
virtual void propagateInputs(ITest& subtest)
Framework method which controls how input parameters to the test are sent to subtests. The ITestCollection implementation copies all input arguments unchanged to all subtests. Called by setup.

Derived classes can override this method to alter this behavior. For example, subclasses may wish to parse or process the inputs before passing them to subtests, or generate inputs for the subtests.

subtest
Subtest to propagate inputs to

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setupSubtests
protected:
virtual void setupSubtests()
This function is called by setup to create the subtests. Derived classes should override setupSubtests to instantiate all subtests and call adoptTest for each subtest. Do not delete your subtests after calling adoptTest.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Input and Output

Class members used to display information to the user.


[view class]
print
protected:
virtual void print(ITieredTextBuffer&)
Customized operator<<(ITieredTextBuffer) implementation.

First calls ITest::print(out), and the prints the number of subtests and the current setting of haltOnFail.

ITieredTextBuffer
Tiered text buffer to print to.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Meta Information

Class member functions used to provide information about the tests.


[view class]
copyInfo
public:
virtual void copyInfo()
Framework method that derived classes can override to provide meta-information about themselves.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Test Control

Class member functions used to control how to run the collection of tests.


[view class]
haltOnFail
public:
bool haltOnFail() const
Returns the current value that indicates whether or not to halt on failure (the current setting of setHaltOnFail).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
randomlyReorder
public:
virtual void randomlyReorder(long initialSeed = 0)
Randomly rearranges the order in which tests will be executed by the test method.
initialSeed
Value used for random number generation; default of 0.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setHaltOnFail
public:
void setHaltOnFail(bool)
Method used to stop running the test collection when any subtest fails.

If client calls this function with true, ITestCollection will halt when any of its subtests fails. If the client calls this function with false, ITestCollection will continue running all tests, even if one or more of the subtests fail. The default behavior is running all tests.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Test Methods

ITest overridden member function used when setting up and running the collection of tests.


[view class]
reset
protected:
virtual void reset()
ITestCollection overrides the ITest::reset method to reset all of its subtests as well as itself.

Subclasses should not need to override reset.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setup
protected:
virtual void setup()
ITestCollection overrides the ITest::setup method.

ITestCollection calls setupSubtests to create all the subtests. setupSubtests is called only once when setup is called for the first time. Next, it calls propagateInputs for all subtests. It then calls ITest::setup.

Subclasses should not need to override setup.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
test
protected:
virtual void test()
ITestCollection overrides the ITest::test method to call the run method for each of its subtests. If all subtests pass, the the ITestCollection passes. If any subtest fails, the the ITestCollection fails. If haltOnFail returns true then no further subtests will be run once any subtest fails. Otherwise, all subtests are always run.

Subclasses should not override test.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ITestCollection - Inherited Member Functions and Data

Inherited Public Functions

ITest

Inherited Public Data

ITest

Inherited Protected Functions

ITest

Inherited Protected Data