Browse Source

Update to NUnit 2.6.0.12051

pull/6/merge
Matt Ward 14 years ago
parent
commit
95aeaba095
  1. BIN
      src/Tools/NUnit/lib/nunit-console-runner.dll
  2. BIN
      src/Tools/NUnit/lib/nunit-gui-runner.dll
  3. BIN
      src/Tools/NUnit/lib/nunit.core.dll
  4. BIN
      src/Tools/NUnit/lib/nunit.core.interfaces.dll
  5. BIN
      src/Tools/NUnit/lib/nunit.uiexception.dll
  6. BIN
      src/Tools/NUnit/lib/nunit.uikit.dll
  7. BIN
      src/Tools/NUnit/lib/nunit.util.dll
  8. 4
      src/Tools/NUnit/license.txt
  9. BIN
      src/Tools/NUnit/nunit-console-dotnet2-x86.exe
  10. 72
      src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config
  11. BIN
      src/Tools/NUnit/nunit-console-dotnet2.exe
  12. 72
      src/Tools/NUnit/nunit-console-dotnet2.exe.config
  13. BIN
      src/Tools/NUnit/nunit-console-x86.exe
  14. 84
      src/Tools/NUnit/nunit-console-x86.exe.config
  15. BIN
      src/Tools/NUnit/nunit-console.exe
  16. 77
      src/Tools/NUnit/nunit-console.exe.config
  17. 6
      src/Tools/NUnit/nunit-console/AssemblyInfo.cs
  18. 161
      src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs
  19. 2
      src/Tools/NUnit/nunit-console/nunit-console.csproj
  20. BIN
      src/Tools/NUnit/nunit.framework.dll

BIN
src/Tools/NUnit/lib/nunit-console-runner.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit-gui-runner.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit.core.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit.core.interfaces.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit.uiexception.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit.uikit.dll

Binary file not shown.

BIN
src/Tools/NUnit/lib/nunit.util.dll

Binary file not shown.

4
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 © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
Copyright © 2000-2002 Philip A. Craig 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. 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. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

BIN
src/Tools/NUnit/nunit-console-dotnet2-x86.exe

Binary file not shown.

72
src/Tools/NUnit/nunit-console-dotnet2-x86.exe.config

@ -1,69 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<!--
The .NET 2.0 build of the console runner only
runs under .NET 2.0 or higher. The setting
useLegacyV2RuntimeActivationPolicy only applies
under .NET 4.0 and permits use of mixed mode
assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- Comment out the next line to force use of .NET 4.0 -->
<supportedRuntime version="v2.0.50727" />
<!-- <supportedRuntime version="v4.0.30319" /> -->
</startup>
<runtime> <runtime>
<!-- We need this so test exceptions don't crash NUnit --> <!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1" /> <legacyUnhandledExceptionPolicy enabled="1" />
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true" />
<!-- Look for addins in the addins directory for now --> <!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/> <probing privatePath="lib;addins"/>
</assemblyBinding> </assemblyBinding>
<!--
The following <assemblyBinding> section allows running nunit under
.NET 1.0 by redirecting assemblies. The appliesTo attribute
causes the section to be ignored except under .NET 1.0
on a machine with only the .NET version 1.0 runtime installed.
If application and its tests were built for .NET 1.1 you will
also need to redirect system assemblies in the test config file,
which controls loading of the tests.
-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="System"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Forms"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

BIN
src/Tools/NUnit/nunit-console-dotnet2.exe

Binary file not shown.

72
src/Tools/NUnit/nunit-console-dotnet2.exe.config

@ -1,69 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<!--
The .NET 2.0 build of the console runner only
runs under .NET 2.0 or higher. The setting
useLegacyV2RuntimeActivationPolicy only applies
under .NET 4.0 and permits use of mixed mode
assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- Comment out the next line to force use of .NET 4.0 -->
<supportedRuntime version="v2.0.50727" />
<!-- <supportedRuntime version="v4.0.30319" /> -->
</startup>
<runtime> <runtime>
<!-- We need this so test exceptions don't crash NUnit --> <!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1" /> <legacyUnhandledExceptionPolicy enabled="1" />
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true" />
<!-- Look for addins in the addins directory for now --> <!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/> <probing privatePath="lib;addins"/>
</assemblyBinding> </assemblyBinding>
<!--
The following <assemblyBinding> section allows running nunit under
.NET 1.0 by redirecting assemblies. The appliesTo attribute
causes the section to be ignored except under .NET 1.0
on a machine with only the .NET version 1.0 runtime installed.
If application and its tests were built for .NET 1.1 you will
also need to redirect system assemblies in the test config file,
which controls loading of the tests.
-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="System"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Forms"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

BIN
src/Tools/NUnit/nunit-console-x86.exe

Binary file not shown.

84
src/Tools/NUnit/nunit-console-x86.exe.config

@ -1,79 +1,31 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <!--
<requiredRuntime version="v4.0" /> The .NET 2.0 build of the console runner only
</startup> runs under .NET 2.0 or higher. The setting
<!-- Set the level for tracing NUnit itself --> useLegacyV2RuntimeActivationPolicy only applies
<!-- 0=Off 1=Error 2=Warning 3=Info 4=Debug --> under .NET 4.0 and permits use of mixed mode
<system.diagnostics> assemblies, which would otherwise not load
<switches> correctly.
<add name="NTrace" value="0" /> -->
</switches> <startup useLegacyV2RuntimeActivationPolicy="true">
</system.diagnostics> <!-- Comment out the next line to force use of .NET 4.0 -->
<!-- <supportedRuntime version="v2.0.50727" /> -->
<supportedRuntime version="v4.0.30319" />
</startup>
<runtime> <runtime>
<!-- We need this so test exceptions don't crash NUnit --> <!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1" /> <legacyUnhandledExceptionPolicy enabled="1" />
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true" />
<!-- Look for addins in the addins directory for now --> <!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/> <probing privatePath="lib;addins"/>
</assemblyBinding> </assemblyBinding>
<!--
The following <assemblyBinding> section allows running nunit under
.NET 1.0 by redirecting assemblies. The appliesTo attribute
causes the section to be ignored except under .NET 1.0
on a machine with only the .NET version 1.0 runtime installed.
If application and its tests were built for .NET 1.1 you will
also need to redirect system assemblies in the test config file,
which controls loading of the tests.
-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="System"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Forms"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

BIN
src/Tools/NUnit/nunit-console.exe

Binary file not shown.

77
src/Tools/NUnit/nunit-console.exe.config

@ -1,72 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <!--
<requiredRuntime version="v4.0" /> The .NET 2.0 build of the console runner only
</startup> runs under .NET 2.0 or higher. The setting
useLegacyV2RuntimeActivationPolicy only applies
under .NET 4.0 and permits use of mixed mode
assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- Comment out the next line to force use of .NET 4.0 -->
<!-- <supportedRuntime version="v2.0.50727" /> -->
<supportedRuntime version="v4.0.30319" />
</startup>
<runtime> <runtime>
<!-- We need this so test exceptions don't crash NUnit --> <!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1" /> <legacyUnhandledExceptionPolicy enabled="1" />
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true" />
<!-- Look for addins in the addins directory for now --> <!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/> <probing privatePath="lib;addins"/>
</assemblyBinding> </assemblyBinding>
<!--
The following <assemblyBinding> section allows running nunit under
.NET 1.0 by redirecting assemblies. The appliesTo attribute
causes the section to be ignored except under .NET 1.0
on a machine with only the .NET version 1.0 runtime installed.
If application and its tests were built for .NET 1.1 you will
also need to redirect system assemblies in the test config file,
which controls loading of the tests.
-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="System"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Forms"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml"
publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="1.0.5000.0"
newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

6
src/Tools/NUnit/nunit-console/AssemblyInfo.cs

@ -16,7 +16,7 @@ using System.Reflection;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NUnit.org")] [assembly: AssemblyCompany("NUnit.org")]
[assembly: AssemblyProduct("NUnit")] [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) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\n" +
"Copyright (C) 2000-2002 Philip Craig.\r\n" + "Copyright (C) 2000-2002 Philip Craig.\r\n" +
"Copyright (C) 2006 Daniel Grunwald.\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 // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("2.5.10")] [assembly: AssemblyVersion("2.6.0")]
[assembly: AssemblyInformationalVersion("2.5.10")] [assembly: AssemblyInformationalVersion("2.6.0")]

161
src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs

@ -4,9 +4,6 @@
// copyright ownership at http://nunit.org. // 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 namespace NUnit.ConsoleRunner
{ {
using System; using System;
@ -30,17 +27,29 @@ namespace NUnit.ConsoleRunner
public static readonly int FIXTURE_NOT_FOUND = -3; public static readonly int FIXTURE_NOT_FOUND = -3;
public static readonly int UNEXPECTED_ERROR = -100; public static readonly int UNEXPECTED_ERROR = -100;
private string workDir;
public ExtendedConsoleUi() public ExtendedConsoleUi()
{ {
} }
public int Execute( ExtendedConsoleOptions options ) 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; TextWriter outWriter = Console.Out;
bool redirectOutput = options.output != null && options.output != string.Empty; bool redirectOutput = options.output != null && options.output != string.Empty;
if ( redirectOutput ) if ( redirectOutput )
{ {
StreamWriter outStreamWriter = new StreamWriter( options.output ); StreamWriter outStreamWriter = new StreamWriter( Path.Combine(workDir, options.output) );
outStreamWriter.AutoFlush = true; outStreamWriter.AutoFlush = true;
outWriter = outStreamWriter; outWriter = outStreamWriter;
} }
@ -49,38 +58,50 @@ namespace NUnit.ConsoleRunner
bool redirectError = options.err != null && options.err != string.Empty; bool redirectError = options.err != null && options.err != string.Empty;
if ( redirectError ) if ( redirectError )
{ {
StreamWriter errorStreamWriter = new StreamWriter( options.err ); StreamWriter errorStreamWriter = new StreamWriter( Path.Combine(workDir, options.err) );
errorStreamWriter.AutoFlush = true; errorStreamWriter.AutoFlush = true;
errorWriter = errorStreamWriter; errorWriter = errorStreamWriter;
} }
TextWriter testResultWriter = null; TextWriter testResultWriter = null;
if ( options.IsResults ) if ( options.IsResults )
{ {
testResultWriter = new StreamWriter ( options.results, false, Encoding.UTF8 ); testResultWriter = new StreamWriter ( options.results, false, Encoding.UTF8 );
((StreamWriter)testResultWriter).AutoFlush = true; ((StreamWriter)testResultWriter).AutoFlush = true;
} }
TestPackage package = MakeTestPackage(options); TestPackage package = MakeTestPackage(options);
Console.WriteLine("ProcessModel: {0} DomainUsage: {1}", ProcessModel processModel = package.Settings.Contains("ProcessModel")
package.Settings.Contains("ProcessModel") ? (ProcessModel)package.Settings["ProcessModel"]
? package.Settings["ProcessModel"] : ProcessModel.Default;
: "Default",
package.Settings.Contains("DomainUsage") DomainUsage domainUsage = package.Settings.Contains("DomainUsage")
? package.Settings["DomainUsage"] ? (DomainUsage)package.Settings["DomainUsage"]
: "Default"); : DomainUsage.Default;
RuntimeFramework framework = package.Settings.Contains("RuntimeFramework")
? (RuntimeFramework)package.Settings["RuntimeFramework"]
: RuntimeFramework.CurrentFramework;
Console.WriteLine("Execution Runtime: {0}", #if CLR_2_0 || CLR_4_0
package.Settings.Contains("RuntimeFramework") Console.WriteLine("ProcessModel: {0} DomainUsage: {1}", processModel, domainUsage);
? package.Settings["RuntimeFramework"]
: "Default");
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(); testRunner.Unload();
Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture); 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 ); ExtendedEventCollector collector = new ExtendedEventCollector( options, outWriter, errorWriter, testResultWriter );
TestFilter testFilter = TestFilter.Empty; TestFilter testFilter = TestFilter.Empty;
SimpleNameFilter nameFilter = new SimpleNameFilter();
if ( options.run != null && options.run != string.Empty ) if ( options.run != null && options.run != string.Empty )
{ {
Console.WriteLine( "Selected test(s): " + options.run ); 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 ) if ( options.include != null && options.include != string.Empty )
{ {
Console.WriteLine( "Included categories: " + options.include );
TestFilter includeFilter = new CategoryExpression( options.include ).Filter; TestFilter includeFilter = new CategoryExpression( options.include ).Filter;
if ( testFilter.IsEmpty ) Console.WriteLine("Included categories: " + includeFilter.ToString());
if (testFilter.IsEmpty)
testFilter = includeFilter; testFilter = includeFilter;
else else
testFilter = new AndFilter( testFilter, includeFilter ); testFilter = new AndFilter( testFilter, includeFilter );
@ -108,8 +152,9 @@ namespace NUnit.ConsoleRunner
if ( options.exclude != null && options.exclude != string.Empty ) if ( options.exclude != null && options.exclude != string.Empty )
{ {
Console.WriteLine( "Excluded categories: " + options.exclude );
TestFilter excludeFilter = new NotFilter( new CategoryExpression( options.exclude ).Filter ); TestFilter excludeFilter = new NotFilter( new CategoryExpression( options.exclude ).Filter );
Console.WriteLine("Excluded categories: " + excludeFilter.ToString());
if ( testFilter.IsEmpty ) if ( testFilter.IsEmpty )
testFilter = excludeFilter; testFilter = excludeFilter;
else if ( testFilter is AndFilter ) else if ( testFilter is AndFilter )
@ -118,9 +163,9 @@ namespace NUnit.ConsoleRunner
testFilter = new AndFilter( testFilter, excludeFilter ); testFilter = new AndFilter( testFilter, excludeFilter );
} }
if (testFilter is NotFilter) if (testFilter is NotFilter)
((NotFilter)testFilter).TopLevel = true; ((NotFilter)testFilter).TopLevel = true;
TestResult result = null; TestResult result = null;
string savedDirectory = Environment.CurrentDirectory; string savedDirectory = Environment.CurrentDirectory;
TextWriter savedOut = Console.Out; TextWriter savedOut = Console.Out;
@ -128,7 +173,7 @@ namespace NUnit.ConsoleRunner
try try
{ {
result = testRunner.Run( collector, testFilter ); result = testRunner.Run( collector, testFilter, false, LoggingThreshold.Off );
} }
finally finally
{ {
@ -164,22 +209,31 @@ namespace NUnit.ConsoleRunner
{ {
WriteSummaryReport(summary); WriteSummaryReport(summary);
if (summary.ErrorsAndFailures > 0 || result.IsError || result.IsFailure) 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); WriteErrorsAndFailuresReport(result);
}
if (summary.TestsNotRun > 0) if (summary.TestsNotRun > 0)
WriteNotRunReport(result); WriteNotRunReport(result);
}
// Write xml output here
string xmlResultFile = options.xml == null || options.xml == string.Empty
? "TestResult.xml" : options.xml;
if (!String.IsNullOrEmpty(options.xml)) if (!options.noresult)
{ {
using (StreamWriter writer = new StreamWriter(xmlResultFile)) // Write xml output here
{ string xmlResultFile = options.result == null || options.result == string.Empty
writer.Write(xmlOutput); ? "TestResult.xml" : options.result;
}
using (StreamWriter writer = new StreamWriter(Path.Combine(workDir, xmlResultFile)))
{
writer.Write(xmlOutput);
}
}
} }
returnCode = summary.ErrorsAndFailures; returnCode = summary.ErrorsAndFailures;
} }
@ -194,9 +248,9 @@ namespace NUnit.ConsoleRunner
} }
#region Helper Methods #region Helper Methods
// TODO: See if this can be unified with the Gui's MakeTestPackage // TODO: See if this can be unified with the Gui's MakeTestPackage
private static TestPackage MakeTestPackage( ConsoleOptions options ) private TestPackage MakeTestPackage( ConsoleOptions options )
{ {
TestPackage package; TestPackage package;
DomainUsage domainUsage = DomainUsage.Default; DomainUsage domainUsage = DomainUsage.Default;
ProcessModel processModel = ProcessModel.Default; ProcessModel processModel = ProcessModel.Default;
@ -205,7 +259,7 @@ namespace NUnit.ConsoleRunner
string[] parameters = new string[options.ParameterCount]; string[] parameters = new string[options.ParameterCount];
for (int i = 0; i < options.ParameterCount; i++) for (int i = 0; i < options.ParameterCount; i++)
parameters[i] = Path.GetFullPath((string)options.Parameters[i]); parameters[i] = Path.GetFullPath((string)options.Parameters[i]);
if (options.IsTestProject) if (options.IsTestProject)
{ {
NUnitProject project = NUnitProject project =
@ -222,26 +276,28 @@ namespace NUnit.ConsoleRunner
} }
else if (parameters.Length == 1) else if (parameters.Length == 1)
{ {
package = new TestPackage(parameters[0]); package = new TestPackage(parameters[0]);
domainUsage = DomainUsage.Single; domainUsage = DomainUsage.Single;
} }
else 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 = new TestPackage(null, parameters);
package.AutoBinPath = true; package.AutoBinPath = true;
domainUsage = DomainUsage.Multiple; domainUsage = DomainUsage.Multiple;
} }
#if CLR_2_0 || CLR_4_0
if (options.framework != null)
framework = RuntimeFramework.Parse(options.framework);
if (options.process != ProcessModel.Default) if (options.process != ProcessModel.Default)
processModel = options.process; processModel = options.process;
#endif
if (options.domain != DomainUsage.Default) if (options.domain != DomainUsage.Default)
domainUsage = options.domain; domainUsage = options.domain;
if (options.framework != null)
framework = RuntimeFramework.Parse(options.framework);
package.TestName = options.fixture; package.TestName = options.fixture;
package.Settings["ProcessModel"] = processModel; package.Settings["ProcessModel"] = processModel;
@ -260,6 +316,11 @@ namespace NUnit.ConsoleRunner
package.Settings["ShadowCopyFiles"] = !options.noshadow; package.Settings["ShadowCopyFiles"] = !options.noshadow;
package.Settings["UseThreadedRunner"] = !options.nothread; package.Settings["UseThreadedRunner"] = !options.nothread;
package.Settings["DefaultTimeout"] = options.timeout; 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; return package;
} }

2
src/Tools/NUnit/nunit-console/nunit-console.csproj

@ -21,7 +21,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\</OutputPath> <OutputPath>..\</OutputPath>
<Optimize>False</Optimize> <Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>TRACE;DEBUG;CLR_2_0,NET_2_0,CS_3_0</DefineConstants>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType> <DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>

BIN
src/Tools/NUnit/nunit.framework.dll

Binary file not shown.
Loading…
Cancel
Save