|
@@ -229,8 +229,10 @@ type
|
|
FFailures: TFPList;
|
|
FFailures: TFPList;
|
|
FErrors: TFPList;
|
|
FErrors: TFPList;
|
|
FListeners: TFPList;
|
|
FListeners: TFPList;
|
|
|
|
+ FSkippedTests: TFPList;
|
|
function GetNumErrors: integer;
|
|
function GetNumErrors: integer;
|
|
function GetNumFailures: integer;
|
|
function GetNumFailures: integer;
|
|
|
|
+ function GetNumSkipped: integer;
|
|
public
|
|
public
|
|
constructor Create; virtual;
|
|
constructor Create; virtual;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
@@ -246,12 +248,16 @@ type
|
|
procedure Run(ATestCase: TTestCase);
|
|
procedure Run(ATestCase: TTestCase);
|
|
procedure RunProtected(ATestCase: TTest; protect: TProtect);
|
|
procedure RunProtected(ATestCase: TTest; protect: TProtect);
|
|
function WasSuccessful: boolean;
|
|
function WasSuccessful: boolean;
|
|
|
|
+ function SkipTest(ATestCase: TTestCase): boolean;
|
|
|
|
+ procedure AddToSkipList(ATestCase: TTestCase);
|
|
|
|
+ procedure RemoveFromSkipList(ATestCase: TTestCase);
|
|
published
|
|
published
|
|
property Failures: TFPList read FFailures;
|
|
property Failures: TFPList read FFailures;
|
|
property Errors: TFPList read FErrors;
|
|
property Errors: TFPList read FErrors;
|
|
property RunTests: integer read FRunTests;
|
|
property RunTests: integer read FRunTests;
|
|
property NumberOfErrors: integer read GetNumErrors;
|
|
property NumberOfErrors: integer read GetNumErrors;
|
|
property NumberOfFailures: integer read GetNumFailures;
|
|
property NumberOfFailures: integer read GetNumFailures;
|
|
|
|
+ property NumberOfSkippedTests: integer read GetNumSkipped;
|
|
end;
|
|
end;
|
|
|
|
|
|
function ComparisonMsg(const aExpected: string; const aActual: string): string;
|
|
function ComparisonMsg(const aExpected: string; const aActual: string): string;
|
|
@@ -971,6 +977,7 @@ begin
|
|
FFailures := TFPList.Create;
|
|
FFailures := TFPList.Create;
|
|
FErrors := TFPList.Create;
|
|
FErrors := TFPList.Create;
|
|
FListeners := TFPList.Create;
|
|
FListeners := TFPList.Create;
|
|
|
|
+ FSkippedTests := TFPList.Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -981,6 +988,7 @@ begin
|
|
FreeObjects(FErrors);
|
|
FreeObjects(FErrors);
|
|
FErrors.Free;
|
|
FErrors.Free;
|
|
FListeners.Free;
|
|
FListeners.Free;
|
|
|
|
+ FSkippedTests.Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1005,6 +1013,12 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+function TTestResult.GetNumSkipped: integer;
|
|
|
|
+begin
|
|
|
|
+ Result := FSkippedTests.Count;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
procedure TTestResult.AddListener(AListener: ITestListener);
|
|
procedure TTestResult.AddListener(AListener: ITestListener);
|
|
begin
|
|
begin
|
|
FListeners.Add(pointer(AListener));
|
|
FListeners.Add(pointer(AListener));
|
|
@@ -1066,9 +1080,12 @@ end;
|
|
|
|
|
|
procedure TTestResult.Run(ATestCase: TTestCase);
|
|
procedure TTestResult.Run(ATestCase: TTestCase);
|
|
begin
|
|
begin
|
|
- StartTest(ATestCase);
|
|
|
|
- RunProtected(ATestCase, @ProtectTest);
|
|
|
|
- EndTest(ATestCase);
|
|
|
|
|
|
+ if not SkipTest(ATestCase) then
|
|
|
|
+ begin
|
|
|
|
+ StartTest(ATestCase);
|
|
|
|
+ RunProtected(ATestCase, @ProtectTest);
|
|
|
|
+ EndTest(ATestCase);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1117,5 +1134,37 @@ begin
|
|
//unlock mutex
|
|
//unlock mutex
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TTestResult.SkipTest(ATestCase: TTestCase): Boolean;
|
|
|
|
+var
|
|
|
|
+ i: integer;
|
|
|
|
+begin
|
|
|
|
+ Result := false;
|
|
|
|
+ if FSkippedTests.Count = 0 then
|
|
|
|
+ begin
|
|
|
|
+ result := false;
|
|
|
|
+ Exit;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ for i := 0 to FSkippedTests.Count - 1 do
|
|
|
|
+ begin
|
|
|
|
+ if PtrInt(FSkippedTests[i]) = PtrInt(ATestCase) then
|
|
|
|
+ begin
|
|
|
|
+ Result := true;
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+procedure TTestResult.AddToSkipList(ATestCase: TTestCase);
|
|
|
|
+begin
|
|
|
|
+ FSkippedTests.Add(ATestCase);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTestResult.RemoveFromSkipList(ATestCase: TTestCase);
|
|
|
|
+begin
|
|
|
|
+ FSkippedTests.Remove(ATestCase);
|
|
|
|
+end;
|
|
|
|
+
|
|
end.
|
|
end.
|
|
|
|
|