AddTests method
Makes a test instance out of each published method of the given testClass and adds them to the suite.

Applies to
TTestSuite

Declaration
Procedure AddTests(testClass: TTestCaseClass);

Parameters
testClass The testCase class with published test methods.

Implementation

procedure TTestSuite.AddTests(testClass: TTestCaseClass);
var
  MethodIter      : Integer;
  NameOfMethod    : string;
  MethodEnumerator : TMethodEnumerator;
begin
  { call on the method enumerator to get the names of the test
    cases in the testClass }
  MethodEnumerator := nil;
  try
    MethodEnumerator := TMethodEnumerator.Create(testClass);
    { make sure we add each test case  to the list of tests }
    for MethodIter := 0 to MethodEnumerator.Methodcount-1 do
      begin
        NameOfMethod := MethodEnumerator.nameOfMethod[MethodIter];
        self.addTest(testClass.Create(NameOfMethod) as ITest);
      end;
  finally
    MethodEnumerator.free;
  end;
End;


HTML generated by Time2HELP
http://www.time2help.com