* SkipTiming by Reinier

git-svn-id: trunk@24170 -
This commit is contained in:
michael 2013-04-07 08:24:22 +00:00
parent b1993beb9f
commit 6c0d61f879
2 changed files with 27 additions and 16 deletions

View File

@ -18,10 +18,10 @@
Purpose: Purpose:
This unit contains a XML TestListener for use with the fpcUnit testing This unit contains an XML TestListener for use with the fpcUnit testing
framework. It uses the XMLWrite unit, which is part of FPC, to generate framework. It uses the XMLWrite unit, which is part of FPC, to generate
the XML document. The benefit of using the XMLWrite unit, is that the the XML document. The benefit of using the XMLWrite unit is that the
data generated is valid XML, with resevered characters correctly escaped. data generated is valid XML, with reserved characters correctly escaped.
This allows the XML document to be further processed with XSLT etc without This allows the XML document to be further processed with XSLT etc without
any issues. any issues.
@ -107,9 +107,12 @@ begin
n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfIgnoredTests))); n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfIgnoredTests)));
lResults.AppendChild(n); lResults.AppendChild(n);
if not(SkipTiming) then
begin
n := FDoc.CreateElement('TotalElapsedTime'); n := FDoc.CreateElement('TotalElapsedTime');
n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime))); n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime)));
lResults.AppendChild(n); lResults.AppendChild(n);
end;
{ Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html } { Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
n := FDoc.CreateElement('DateTimeRan'); n := FDoc.CreateElement('DateTimeRan');
@ -244,10 +247,13 @@ var
lNew: TDOMElement; lNew: TDOMElement;
begin begin
n := FLastTestSuite.LastChild; n := FLastTestSuite.LastChild;
if not(SkipTiming) then
begin
lNew := FDoc.CreateElement('ElapsedTime'); lNew := FDoc.CreateElement('ElapsedTime');
lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono))); lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono)));
n.AppendChild(lNew); n.AppendChild(lNew);
end; end;
end;
procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite); procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite);
var var

View File

@ -129,6 +129,7 @@ end;
procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
begin begin
inherited; inherited;
if not SkipTiming then
FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming); FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
end; end;
@ -156,6 +157,7 @@ var
begin begin
inherited; inherited;
n := TDomElement(FSuitePath[FSuitePath.Count -1]); n := TDomElement(FSuitePath[FSuitePath.Count -1]);
if not SkipTiming then
n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming); n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
n['NumberOfRunTests'] := IntToStr(ANumRuns); n['NumberOfRunTests'] := IntToStr(ANumRuns);
n['NumberOfErrors'] := IntToStr(ANumErrors); n['NumberOfErrors'] := IntToStr(ANumErrors);
@ -267,10 +269,13 @@ begin
n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfIgnoredTests))); n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfIgnoredTests)));
lResults.AppendChild(n); lResults.AppendChild(n);
if not SkipTiming then
begin
n := FDoc.CreateElement('TotalElapsedTime'); n := FDoc.CreateElement('TotalElapsedTime');
n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz',
Now - aResult.StartingTime))); Now - aResult.StartingTime)));
lResults.AppendChild(n); lResults.AppendChild(n);
end;
{ Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html } { Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
n := FDoc.CreateElement('DateTimeRan'); n := FDoc.CreateElement('DateTimeRan');