2004-11-26 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Fri, 26 Nov 2004 14:10:10 +0000 (14:10 -0000)
committerMartin Baulig <martin@novell.com>
Fri, 26 Nov 2004 14:10:10 +0000 (14:10 -0000)
* ConsoleUI.cs (ConsoleUI.Execute): Print a short summary (number
of tests run, ignored, failed) to the console, honor the /output
argument for the detailed summary.

svn path=/trunk/mcs/; revision=36633

mcs/nunit20/nunit-console/ChangeLog
mcs/nunit20/nunit-console/ConsoleUi.cs

index 0c5eb7809c4f9dde82217098914b07f8f37c76d3..a8fea12631a4aed2b1e9c763b720c18bcf9cca04 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-26  Martin Baulig  <martin@ximian.com>
+
+       * ConsoleUI.cs (ConsoleUI.Execute): Print a short summary (number
+       of tests run, ignored, failed) to the console, honor the /output
+       argument for the detailed summary.      
+
 2004-11-23  Raja R Harinath  <rharinath@novell.com>
 
        * Makefile (NO_INSTALL): Don't install nunit-console.exe.
index 23780997bd267c2d6d78b6a8da70782a8ad03b47..23317de55efe835b3d6348919e3214110ce45723 100755 (executable)
@@ -203,7 +203,7 @@ namespace NUnit.Console
 
                        Directory.SetCurrentDirectory(new FileInfo((string)options.Parameters[0]).DirectoryName);
                
-                       EventListener collector = new EventCollector( options, outStream );
+                       EventCollector collector = new EventCollector( options, outStream );
 
                        string savedDirectory = Environment.CurrentDirectory;
 
@@ -232,6 +232,9 @@ namespace NUnit.Console
 
                        Directory.SetCurrentDirectory( savedDirectory );
                        
+                       Console.WriteLine();
+                       Console.WriteLine();
+                       collector.PrintSummary( result );
                        Console.WriteLine();
 
                        string xmlOutput = CreateXmlOutput( result );
@@ -239,7 +242,7 @@ namespace NUnit.Console
                        if (options.xmlConsole)
                                Console.WriteLine(xmlOutput);
                        else
-                               CreateSummaryDocument(xmlOutput, transformReader);
+                               CreateSummaryDocument(xmlOutput, transformReader, outStream);
 
                        // Write xml output here
                        string xmlResultFile = options.IsXml ? options.xml : "TestResult.xml";
@@ -265,7 +268,8 @@ namespace NUnit.Console
                        return builder.ToString();
                }
 
-               private void CreateSummaryDocument(string xmlOutput, XmlTextReader transformReader)
+               private void CreateSummaryDocument(string xmlOutput, XmlTextReader transformReader,
+                                                  ConsoleWriter outStream)
                {
                        XPathDocument originalXPathDocument = new XPathDocument(new StringReader(xmlOutput));
                        XslTransform summaryXslTransform = new XslTransform();
@@ -274,7 +278,7 @@ namespace NUnit.Console
                        summaryXslTransform.Load(transformReader);
                        
                        // Using obsolete form for now, remove warning suppression from project after changing
-                       summaryXslTransform.Transform(originalXPathDocument,null,Console.Out);
+                       summaryXslTransform.Transform(originalXPathDocument,null,outStream);
                }
 
                #region Nested Class to Handle Events
@@ -407,6 +411,12 @@ namespace NUnit.Console
                                }
                        }
 
+                       public void PrintSummary (TestResult suiteResult)
+                       {
+                               Console.WriteLine("Tests run: {0}, Failures: {1}, Not run: {2}, Time: {3} seconds",
+                                                 testRunCount, failureCount, testIgnoreCount, suiteResult.Time);
+                       }
+
                        public void UnhandledException( Exception exception )
                        {
                                string msg = string.Format( "##### Unhandled Exception while running {0}", currentTestName );