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; |