* 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);
n := FDoc.CreateElement('TotalElapsedTime'); if not(SkipTiming) then
n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime))); begin
lResults.AppendChild(n); n := FDoc.CreateElement('TotalElapsedTime');
n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime)));
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,9 +247,12 @@ var
lNew: TDOMElement; lNew: TDOMElement;
begin begin
n := FLastTestSuite.LastChild; n := FLastTestSuite.LastChild;
lNew := FDoc.CreateElement('ElapsedTime'); if not(SkipTiming) then
lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono))); begin
n.AppendChild(lNew); lNew := FDoc.CreateElement('ElapsedTime');
lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono)));
n.AppendChild(lNew);
end;
end; end;
procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite); procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite);

View File

@ -129,7 +129,8 @@ end;
procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
begin begin
inherited; inherited;
FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming); if not SkipTiming then
FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
end; end;
@ -156,7 +157,8 @@ var
begin begin
inherited; inherited;
n := TDomElement(FSuitePath[FSuitePath.Count -1]); n := TDomElement(FSuitePath[FSuitePath.Count -1]);
n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming); if not SkipTiming then
n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
n['NumberOfRunTests'] := IntToStr(ANumRuns); n['NumberOfRunTests'] := IntToStr(ANumRuns);
n['NumberOfErrors'] := IntToStr(ANumErrors); n['NumberOfErrors'] := IntToStr(ANumErrors);
n['NumberOfFailures'] := IntToStr(ANumFailures); n['NumberOfFailures'] := IntToStr(ANumFailures);
@ -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);
n := FDoc.CreateElement('TotalElapsedTime'); if not SkipTiming then
n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', begin
Now - aResult.StartingTime))); n := FDoc.CreateElement('TotalElapsedTime');
lResults.AppendChild(n); n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz',
Now - aResult.StartingTime)));
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');