### 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.

~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

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

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.

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

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

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.

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.

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.

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

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

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.

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

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

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

  -     virtual ~ITest()

  -     void copyInputs(int& argc, char * *& argv) const

  -     virtual EStage exceptionStage() const

  -     virtual bool lookupInfo(const IString& key, IString& info)

  -     ITest& operator =(const ITest& test)

  -     ITieredTextBuffer& outputTextStream()

  -     virtual void run()

  -     virtual unsigned long runCount() const

  -     void setInputs(const int argc, const char * const* argv)

  -     bool success() const

#### Inherited Public Data

  ITest

  -     static const IString & _Import kComponentKey

  -     static const IString& kComponentKey

  -     static const IString & _Import kDescriptionKey

  -     static const IString& kDescriptionKey

  -     static const IString & _Import kInputSyntaxKey

  -     static const IString& kInputSyntaxKey

  -     static const IString& kTargetClassKey

  -     static const IString & _Import kTargetClassKey

  -     static const IString& kTestNameKey

  -     static const IString & _Import kTestNameKey

  -     static const IString& kTestTypeKey

  -     static const IString & _Import kTestTypeKey

  -     static const IString& kTestVersionKey

  -     static const IString & _Import kTestVersionKey

#### Inherited Protected Functions

  ITest

  -     virtual void addInfo(const IString&, const IString&)

  -     virtual void cleanup()

  -     virtual bool isReset() const

  -     virtual bool isSuccessUndecided() const

  -     ITest()

  -     ITest(const ITest& test)

  -     virtual void setStickySuccess(bool success)

  -     virtual void setSuccess(bool success)

  -     virtual void test() = 0

#### Inherited Protected Data

  - None