AddError method |
Applies to
TTestResult
Declaration
Function AddError(test: ITest; e: Exception; msg :string = ''): TTestFailure;
Description
Creates a TTestFailure recording that an error occurred in test. Notifies any registered ITestListeners that an error occurred. The TTestFailure returned should not be freed.
Parameters |
test | The test with an error. |
e | The exception that caused the error. |
Returns
the TTestFailure object representing this error.Implementation
function TTestResult.AddError(test: ITest; e: Exception; msg :string): TTestFailure; var i: integer; error : TTestFailure; begin assert(assigned(test)); assert(assigned(e)); assert(assigned(fErrors)); error := TTestFailure.Create(test, e, msg); fErrors.add(error); for i := 0 to fListeners.count - 1 do begin (fListeners[i] as ITestListener).AddError(error); end; assert(assigned(error)); Result := error; End; |
|