I wrote a procedure that takes a set of tests and a list of test names, disables all tests with the corresponding name, and also recurses into nested test packages.
procedure DisableTests(const ATest: ITest; const AExclude: TStrings);
var
I: Integer;
begin
if AExclude.IndexOf(ATest.Name) <> -1 then
begin
ATest.Enabled := False;
end;
for I := 0 to ATest.Tests.Count - 1 do
begin
DisableTests(ATest.Tests[I] as ITest, AExclude);
end
end;
Usage example (TStringlist "Exceptions" is created in the installation method):
procedure TSuiteVersion1beta2.SetUp;
begin
inherited;
Excludes.Add('TestA');
Excludes.Add('TestB');
DisableTests(Self, Excludes);
end;
source
share