Browse Source

* SkipTiming by Reinier

git-svn-id: trunk@24170 -
michael 12 years ago
parent
commit
6c0d61f879
2 changed files with 27 additions and 16 deletions
  1. 16 10
      packages/fcl-fpcunit/src/xmlreporter.pas
  2. 11 6
      packages/fcl-fpcunit/src/xmltestreport.pp

+ 16 - 10
packages/fcl-fpcunit/src/xmlreporter.pas

@@ -18,10 +18,10 @@
   
   
 
 
   Purpose:
   Purpose:
-    This unit contains a XML TestListener for use with the fpcUnit testing
-    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
-    data generated is valid XML, with resevered characters correctly escaped.
+    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
+    the XML document. The benefit of using the XMLWrite unit is that the
+    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');
-  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime)));
-  lResults.AppendChild(n);
+  if not(SkipTiming) then
+  begin
+    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');
-  lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono)));
-  n.AppendChild(lNew);
+  if not(SkipTiming) then
+  begin
+    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);

+ 11 - 6
packages/fcl-fpcunit/src/xmltestreport.pp

@@ -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');
-  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', 
-    Now - aResult.StartingTime)));
-  lResults.AppendChild(n);     
+  if not SkipTiming then
+  begin
+    n := FDoc.CreateElement('TotalElapsedTime');
+    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');