diff --git a/src/Tools/NUnit/lib/nunit-console-runner.dll b/src/Tools/NUnit/lib/nunit-console-runner.dll index 1709ce7bd2..b0e611afb7 100644 Binary files a/src/Tools/NUnit/lib/nunit-console-runner.dll and b/src/Tools/NUnit/lib/nunit-console-runner.dll differ diff --git a/src/Tools/NUnit/lib/nunit-gui-runner.dll b/src/Tools/NUnit/lib/nunit-gui-runner.dll index 35efa737c3..ebff05eb7d 100644 Binary files a/src/Tools/NUnit/lib/nunit-gui-runner.dll and b/src/Tools/NUnit/lib/nunit-gui-runner.dll differ diff --git a/src/Tools/NUnit/lib/nunit.core.dll b/src/Tools/NUnit/lib/nunit.core.dll index a1dd69866d..5f748becd1 100644 Binary files a/src/Tools/NUnit/lib/nunit.core.dll and b/src/Tools/NUnit/lib/nunit.core.dll differ diff --git a/src/Tools/NUnit/lib/nunit.core.interfaces.dll b/src/Tools/NUnit/lib/nunit.core.interfaces.dll index 0ac8788205..72b9486d74 100644 Binary files a/src/Tools/NUnit/lib/nunit.core.interfaces.dll and b/src/Tools/NUnit/lib/nunit.core.interfaces.dll differ diff --git a/src/Tools/NUnit/lib/nunit.uiexception.dll b/src/Tools/NUnit/lib/nunit.uiexception.dll index 610c1700ed..9129c039ad 100644 Binary files a/src/Tools/NUnit/lib/nunit.uiexception.dll and b/src/Tools/NUnit/lib/nunit.uiexception.dll differ diff --git a/src/Tools/NUnit/lib/nunit.uikit.dll b/src/Tools/NUnit/lib/nunit.uikit.dll index 9087db2d16..76c1af4fdf 100644 Binary files a/src/Tools/NUnit/lib/nunit.uikit.dll and b/src/Tools/NUnit/lib/nunit.uikit.dll differ diff --git a/src/Tools/NUnit/lib/nunit.util.dll b/src/Tools/NUnit/lib/nunit.util.dll index 0b315c2106..28d603c662 100644 Binary files a/src/Tools/NUnit/lib/nunit.util.dll and b/src/Tools/NUnit/lib/nunit.util.dll differ diff --git a/src/Tools/NUnit/license.txt b/src/Tools/NUnit/license.txt index 66a5ebf28b..530a6e0036 100644 --- a/src/Tools/NUnit/license.txt +++ b/src/Tools/NUnit/license.txt @@ -1,4 +1,4 @@ -Copyright © 2002-2008 Charlie Poole +Copyright © 2002-2012 Charlie Poole Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov Copyright © 2000-2002 Philip A. Craig @@ -8,7 +8,7 @@ Permission is granted to anyone to use this software for any purpose, including 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. -Portions Copyright © 2002-2008 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig +Portions Copyright © 2002-2012 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. diff --git a/src/Tools/NUnit/nunit-console-dotnet2-x86.exe b/src/Tools/NUnit/nunit-console-dotnet2-x86.exe index def5f1889a..7514847e53 100755 Binary files a/src/Tools/NUnit/nunit-console-dotnet2-x86.exe and b/src/Tools/NUnit/nunit-console-dotnet2-x86.exe differ diff --git a/src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config b/src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config index fa0a2621b3..abbe917a35 100644 --- a/src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config +++ b/src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config @@ -1,69 +1,31 @@ + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/NUnit/nunit-console-dotnet2.exe b/src/Tools/NUnit/nunit-console-dotnet2.exe index 67ba103ffb..11542bdc2e 100755 Binary files a/src/Tools/NUnit/nunit-console-dotnet2.exe and b/src/Tools/NUnit/nunit-console-dotnet2.exe differ diff --git a/src/Tools/NUnit/nunit-console-dotnet2.exe.config b/src/Tools/NUnit/nunit-console-dotnet2.exe.config index fa0a2621b3..abbe917a35 100644 --- a/src/Tools/NUnit/nunit-console-dotnet2.exe.config +++ b/src/Tools/NUnit/nunit-console-dotnet2.exe.config @@ -1,69 +1,31 @@ + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/NUnit/nunit-console-x86.exe b/src/Tools/NUnit/nunit-console-x86.exe index def5f1889a..7514847e53 100644 Binary files a/src/Tools/NUnit/nunit-console-x86.exe and b/src/Tools/NUnit/nunit-console-x86.exe differ diff --git a/src/Tools/NUnit/nunit-console-x86.exe.config b/src/Tools/NUnit/nunit-console-x86.exe.config index ea6adb310c..f31d1de2e8 100644 --- a/src/Tools/NUnit/nunit-console-x86.exe.config +++ b/src/Tools/NUnit/nunit-console-x86.exe.config @@ -1,79 +1,31 @@ - + - - - - - - - - - - + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/NUnit/nunit-console.exe b/src/Tools/NUnit/nunit-console.exe index 67ba103ffb..11542bdc2e 100644 Binary files a/src/Tools/NUnit/nunit-console.exe and b/src/Tools/NUnit/nunit-console.exe differ diff --git a/src/Tools/NUnit/nunit-console.exe.config b/src/Tools/NUnit/nunit-console.exe.config index e308372209..f31d1de2e8 100644 --- a/src/Tools/NUnit/nunit-console.exe.config +++ b/src/Tools/NUnit/nunit-console.exe.config @@ -1,72 +1,31 @@ - - - - + + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/NUnit/nunit-console/AssemblyInfo.cs b/src/Tools/NUnit/nunit-console/AssemblyInfo.cs index 4b88389d14..58f6eb3925 100644 --- a/src/Tools/NUnit/nunit-console/AssemblyInfo.cs +++ b/src/Tools/NUnit/nunit-console/AssemblyInfo.cs @@ -16,7 +16,7 @@ using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NUnit.org")] [assembly: AssemblyProduct("NUnit")] -[assembly: AssemblyCopyright("Copyright (C) 2002-2010 Charlie Poole.\r\n" + +[assembly: AssemblyCopyright("Copyright (C) 2002-2012 Charlie Poole.\r\n" + "Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\n" + "Copyright (C) 2000-2002 Philip Craig.\r\n" + "Copyright (C) 2006 Daniel Grunwald.\r\n" + @@ -36,5 +36,5 @@ using System.Reflection; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.10")] -[assembly: AssemblyInformationalVersion("2.5.10")] +[assembly: AssemblyVersion("2.6.0")] +[assembly: AssemblyInformationalVersion("2.6.0")] diff --git a/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs b/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs index bb2330fb56..832d19f4a8 100644 --- a/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs +++ b/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs @@ -4,9 +4,6 @@ // copyright ownership at http://nunit.org. // **************************************************************** -// This version of NUnit-console is modified to support: -// 1) Writing all tests results to a file as the test results are known. - namespace NUnit.ConsoleRunner { using System; @@ -30,17 +27,29 @@ namespace NUnit.ConsoleRunner public static readonly int FIXTURE_NOT_FOUND = -3; public static readonly int UNEXPECTED_ERROR = -100; + private string workDir; + public ExtendedConsoleUi() { } public int Execute( ExtendedConsoleOptions options ) { + this.workDir = options.work; + if (workDir == null || workDir == string.Empty) + workDir = Environment.CurrentDirectory; + else + { + workDir = Path.GetFullPath(workDir); + if (!Directory.Exists(workDir)) + Directory.CreateDirectory(workDir); + } + TextWriter outWriter = Console.Out; bool redirectOutput = options.output != null && options.output != string.Empty; if ( redirectOutput ) { - StreamWriter outStreamWriter = new StreamWriter( options.output ); + StreamWriter outStreamWriter = new StreamWriter( Path.Combine(workDir, options.output) ); outStreamWriter.AutoFlush = true; outWriter = outStreamWriter; } @@ -49,38 +58,50 @@ namespace NUnit.ConsoleRunner bool redirectError = options.err != null && options.err != string.Empty; if ( redirectError ) { - StreamWriter errorStreamWriter = new StreamWriter( options.err ); + StreamWriter errorStreamWriter = new StreamWriter( Path.Combine(workDir, options.err) ); errorStreamWriter.AutoFlush = true; errorWriter = errorStreamWriter; } - + TextWriter testResultWriter = null; if ( options.IsResults ) { testResultWriter = new StreamWriter ( options.results, false, Encoding.UTF8 ); ((StreamWriter)testResultWriter).AutoFlush = true; } - TestPackage package = MakeTestPackage(options); - Console.WriteLine("ProcessModel: {0} DomainUsage: {1}", - package.Settings.Contains("ProcessModel") - ? package.Settings["ProcessModel"] - : "Default", - package.Settings.Contains("DomainUsage") - ? package.Settings["DomainUsage"] - : "Default"); + ProcessModel processModel = package.Settings.Contains("ProcessModel") + ? (ProcessModel)package.Settings["ProcessModel"] + : ProcessModel.Default; + + DomainUsage domainUsage = package.Settings.Contains("DomainUsage") + ? (DomainUsage)package.Settings["DomainUsage"] + : DomainUsage.Default; + + RuntimeFramework framework = package.Settings.Contains("RuntimeFramework") + ? (RuntimeFramework)package.Settings["RuntimeFramework"] + : RuntimeFramework.CurrentFramework; - Console.WriteLine("Execution Runtime: {0}", - package.Settings.Contains("RuntimeFramework") - ? package.Settings["RuntimeFramework"] - : "Default"); +#if CLR_2_0 || CLR_4_0 + Console.WriteLine("ProcessModel: {0} DomainUsage: {1}", processModel, domainUsage); - using (TestRunner testRunner = new DefaultTestRunnerFactory().MakeTestRunner(package)) + Console.WriteLine("Execution Runtime: {0}", framework); +#else + Console.WriteLine("DomainUsage: {0}", domainUsage); + + if (processModel != ProcessModel.Default && processModel != ProcessModel.Single) + Console.WriteLine("Warning: Ignoring project setting 'processModel={0}'", processModel); + + if (!RuntimeFramework.CurrentFramework.Supports(framework)) + Console.WriteLine("Warning: Ignoring project setting 'runtimeFramework={0}'", framework); +#endif + + using (TestRunner testRunner = new DefaultTestRunnerFactory().MakeTestRunner(package)) { - testRunner.Load(package); + testRunner.Load(package); - if (testRunner.Test == null) + if (testRunner.Test == null) { testRunner.Unload(); Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture); @@ -90,17 +111,40 @@ namespace NUnit.ConsoleRunner ExtendedEventCollector collector = new ExtendedEventCollector( options, outWriter, errorWriter, testResultWriter ); TestFilter testFilter = TestFilter.Empty; + SimpleNameFilter nameFilter = new SimpleNameFilter(); + if ( options.run != null && options.run != string.Empty ) { Console.WriteLine( "Selected test(s): " + options.run ); - testFilter = new SimpleNameFilter( TestNameParser.Parse(options.run) ); + foreach (string name in TestNameParser.Parse(options.run)) + nameFilter.Add(name); + testFilter = nameFilter; } + if (options.runlist != null && options.runlist != string.Empty) + { + Console.WriteLine("Run list: " + options.runlist); + using (StreamReader rdr = new StreamReader(options.runlist)) + { + // NOTE: We can't use rdr.EndOfStream because it's + // not present in .NET 1.x. + string line = rdr.ReadLine(); + while (line != null) + { + if (line[0] != '#') + nameFilter.Add(line); + line = rdr.ReadLine(); + } + } + testFilter = nameFilter; + } + if ( options.include != null && options.include != string.Empty ) { - Console.WriteLine( "Included categories: " + options.include ); TestFilter includeFilter = new CategoryExpression( options.include ).Filter; - if ( testFilter.IsEmpty ) + Console.WriteLine("Included categories: " + includeFilter.ToString()); + + if (testFilter.IsEmpty) testFilter = includeFilter; else testFilter = new AndFilter( testFilter, includeFilter ); @@ -108,8 +152,9 @@ namespace NUnit.ConsoleRunner if ( options.exclude != null && options.exclude != string.Empty ) { - Console.WriteLine( "Excluded categories: " + options.exclude ); TestFilter excludeFilter = new NotFilter( new CategoryExpression( options.exclude ).Filter ); + Console.WriteLine("Excluded categories: " + excludeFilter.ToString()); + if ( testFilter.IsEmpty ) testFilter = excludeFilter; else if ( testFilter is AndFilter ) @@ -118,9 +163,9 @@ namespace NUnit.ConsoleRunner testFilter = new AndFilter( testFilter, excludeFilter ); } - if (testFilter is NotFilter) - ((NotFilter)testFilter).TopLevel = true; - + if (testFilter is NotFilter) + ((NotFilter)testFilter).TopLevel = true; + TestResult result = null; string savedDirectory = Environment.CurrentDirectory; TextWriter savedOut = Console.Out; @@ -128,7 +173,7 @@ namespace NUnit.ConsoleRunner try { - result = testRunner.Run( collector, testFilter ); + result = testRunner.Run( collector, testFilter, false, LoggingThreshold.Off ); } finally { @@ -164,22 +209,31 @@ namespace NUnit.ConsoleRunner { WriteSummaryReport(summary); if (summary.ErrorsAndFailures > 0 || result.IsError || result.IsFailure) + { + if (options.stoponerror) + { + Console.WriteLine("Test run was stopped after first error, as requested."); + Console.WriteLine(); + } + WriteErrorsAndFailuresReport(result); + } if (summary.TestsNotRun > 0) WriteNotRunReport(result); - } - - // Write xml output here - string xmlResultFile = options.xml == null || options.xml == string.Empty - ? "TestResult.xml" : options.xml; - if (!String.IsNullOrEmpty(options.xml)) - { - using (StreamWriter writer = new StreamWriter(xmlResultFile)) - { - writer.Write(xmlOutput); - } + if (!options.noresult) + { + // Write xml output here + string xmlResultFile = options.result == null || options.result == string.Empty + ? "TestResult.xml" : options.result; + + using (StreamWriter writer = new StreamWriter(Path.Combine(workDir, xmlResultFile))) + { + writer.Write(xmlOutput); + } + } } + returnCode = summary.ErrorsAndFailures; } @@ -194,9 +248,9 @@ namespace NUnit.ConsoleRunner } #region Helper Methods - // TODO: See if this can be unified with the Gui's MakeTestPackage - private static TestPackage MakeTestPackage( ConsoleOptions options ) - { + // TODO: See if this can be unified with the Gui's MakeTestPackage + private TestPackage MakeTestPackage( ConsoleOptions options ) + { TestPackage package; DomainUsage domainUsage = DomainUsage.Default; ProcessModel processModel = ProcessModel.Default; @@ -205,7 +259,7 @@ namespace NUnit.ConsoleRunner string[] parameters = new string[options.ParameterCount]; for (int i = 0; i < options.ParameterCount; i++) parameters[i] = Path.GetFullPath((string)options.Parameters[i]); - + if (options.IsTestProject) { NUnitProject project = @@ -222,26 +276,28 @@ namespace NUnit.ConsoleRunner } else if (parameters.Length == 1) { - package = new TestPackage(parameters[0]); + package = new TestPackage(parameters[0]); domainUsage = DomainUsage.Single; } else { - // TODO: Figure out a better way to handle "anonymous" packages + // TODO: Figure out a better way to handle "anonymous" packages package = new TestPackage(null, parameters); - package.AutoBinPath = true; + package.AutoBinPath = true; domainUsage = DomainUsage.Multiple; } +#if CLR_2_0 || CLR_4_0 + if (options.framework != null) + framework = RuntimeFramework.Parse(options.framework); + if (options.process != ProcessModel.Default) processModel = options.process; +#endif if (options.domain != DomainUsage.Default) domainUsage = options.domain; - if (options.framework != null) - framework = RuntimeFramework.Parse(options.framework); - package.TestName = options.fixture; package.Settings["ProcessModel"] = processModel; @@ -260,6 +316,11 @@ namespace NUnit.ConsoleRunner package.Settings["ShadowCopyFiles"] = !options.noshadow; package.Settings["UseThreadedRunner"] = !options.nothread; package.Settings["DefaultTimeout"] = options.timeout; + package.Settings["WorkDirectory"] = this.workDir; + package.Settings["StopOnError"] = options.stoponerror; + + if (options.apartment != System.Threading.ApartmentState.Unknown) + package.Settings["ApartmentState"] = options.apartment; return package; } diff --git a/src/Tools/NUnit/nunit-console/nunit-console.csproj b/src/Tools/NUnit/nunit-console/nunit-console.csproj index a7178f6464..a37d0c32b9 100644 --- a/src/Tools/NUnit/nunit-console/nunit-console.csproj +++ b/src/Tools/NUnit/nunit-console/nunit-console.csproj @@ -21,7 +21,7 @@ ..\ False - DEBUG;TRACE + TRACE;DEBUG;CLR_2_0,NET_2_0,CS_3_0 true Full True diff --git a/src/Tools/NUnit/nunit.framework.dll b/src/Tools/NUnit/nunit.framework.dll index 6856e51ef0..eaea9eedf7 100755 Binary files a/src/Tools/NUnit/nunit.framework.dll and b/src/Tools/NUnit/nunit.framework.dll differ