fpcunit gui testrunner: cleanup

* use StartTime from TestResult
* formatting: testResult -> TestResult

git-svn-id: trunk@27873 -
This commit is contained in:
vincents 2010-10-26 07:56:39 +00:00
parent 89a235667f
commit 61d35b321a

View File

@ -677,9 +677,7 @@ procedure TGUITestRunner.RunTest(ATest: TTest);
end; end;
var var
testResult:TTestResult; TestResult:TTestResult;
FStopCrono: TDateTime;
FStartCrono: TDateTime;
w: TXMLResultsWriter; w: TXMLResultsWriter;
m: TMemoryStream; m: TMemoryStream;
@ -691,25 +689,22 @@ begin
testsCounter := 0; testsCounter := 0;
skipsCounter := 0; skipsCounter := 0;
EnableRunActions(false); EnableRunActions(false);
testResult := TTestResult.Create; TestResult := TTestResult.Create;
try try
SkipUncheckedTests(testResult, TestTree.Selected); SkipUncheckedTests(TestResult, TestTree.Selected);
skipsCounter := testResult.NumberOfSkippedTests; skipsCounter := TestResult.NumberOfSkippedTests;
testResult.AddListener(self); TestResult.AddListener(self);
pbBar.Invalidate; pbBar.Invalidate;
w := TXMLResultsWriter.Create(nil); w := TXMLResultsWriter.Create(nil);
w.FileName := 'null'; // prevents output to the console w.FileName := 'null'; // prevents output to the console
testResult.AddListener(w); TestResult.AddListener(w);
MemoLog(Format(rsRunning, [TestTree.Selected.Text])); MemoLog(Format(rsRunning, [TestTree.Selected.Text]));
FStartCrono := Now; aTest.Run(TestResult);
aTest.Run(testResult); MemoLog(Format(rsNumberOfExec, [IntToStr(TestResult.RunTests),
FStopCrono := Now; FormatDateTime('hh:nn:ss.zzz', Now - TestResult.StartingTime)]));
// In the next fpc (post 2.0.4) we can pull the time from the TestResult
MemoLog(Format(rsNumberOfExec, [IntToStr(testResult.RunTests),
FormatDateTime('hh:nn:ss.zzz', FStopCrono - FStartCrono)]));
w.WriteResult(testResult); w.WriteResult(TestResult);
m := TMemoryStream.Create; m := TMemoryStream.Create;
WriteXMLFile(w.Document, m); WriteXMLFile(w.Document, m);
m.Position := 0; m.Position := 0;
@ -721,7 +716,7 @@ begin
m.free; m.free;
w.Free; w.Free;
testResult.Free; TestResult.Free;
end; end;
end; end;