diff --git a/data/templates/file/CSharp/CSharp.UnitTest.xft b/data/templates/file/CSharp/CSharp.UnitTest.xft index 046399e532..435816c64f 100644 --- a/data/templates/file/CSharp/CSharp.UnitTest.xft +++ b/data/templates/file/CSharp/CSharp.UnitTest.xft @@ -56,7 +56,6 @@ <% } %> using System; using NUnit.Framework; -using NUnit.Framework.SyntaxHelpers; namespace ${StandardNamespace} { diff --git a/data/templates/file/VBNet/VBNet.UnitTest.xft b/data/templates/file/VBNet/VBNet.UnitTest.xft index 90e94ed88e..1e16516821 100644 --- a/data/templates/file/VBNet/VBNet.UnitTest.xft +++ b/data/templates/file/VBNet/VBNet.UnitTest.xft @@ -45,7 +45,6 @@ <Files> <File name="${FullName}" language="VBNET"><![CDATA[${StandardHeader.VBNET} Imports NUnit.Framework -Imports NUnit.Framework.SyntaxHelpers <TestFixture> _ Public Class ${ClassName} diff --git a/src/Setup/Files.wxs b/src/Setup/Files.wxs index 162b800507..292c4f299c 100644 --- a/src/Setup/Files.wxs +++ b/src/Setup/Files.wxs @@ -409,35 +409,34 @@ </Component> </Directory> <Directory Id="NUnitFolder" Name="NUnit"> - <Component Guid="264B36E0-A168-432B-A227-F628D0159370" Id="NUnitCoreExtensionsDll" DiskId="1"> - <File Source="..\..\bin\Tools\NUnit\nunit.core.extensions.dll" Id="nunit.core.extensions.dll" Name="nunit.core.extensions.dll" Assembly=".net" AssemblyApplication="nunit.core.extensions.dll" AssemblyManifest="nunit.core.extensions.dll" KeyPath="yes" /> - </Component> - <Component Guid="77AD4995-2B2B-4E93-86B2-78FEF44A2E23" Id="NUnitUiKitDll" DiskId="1"> - <File Source="..\..\bin\Tools\NUnit\nunit.uikit.dll" Id="nunit.uikit.dll" Name="nunit.uikit.dll" Assembly=".net" AssemblyApplication="nunit.uikit.dll" AssemblyManifest="nunit.uikit.dll" KeyPath="yes" /> - </Component> - <Component Guid="05C2C035-FD03-4E68-B4B4-A20906FEBA9E" Id="NUnitUtilDll" DiskId="1"> - <File Source="..\..\bin\Tools\NUnit\nunit.util.dll" Id="nunit.util.dll" Name="nunit.util.dll" Assembly=".net" AssemblyApplication="nunit.util.dll" AssemblyManifest="nunit.util.dll" KeyPath="yes" /> - </Component> <Component Guid="108E9A75-72D2-40FA-B65C-EFB5ECADB245" Id="NUnitConsoleFiles" DiskId="1"> <File Source="..\..\bin\Tools\NUnit\nunit-console.exe" Id="nunit_console.exe" Name="nunit-console.exe" Assembly=".net" AssemblyApplication="nunit_console.exe" AssemblyManifest="nunit_console.exe" KeyPath="yes" /> <File Source="..\..\bin\Tools\NUnit\nunit-console.exe.config" Id="nunit_console.exe.config" Name="nunit-console.exe.config" /> </Component> - <Component Guid="D27CF2E9-B836-4581-8FF3-23D1154FC9B8" Id="NunitConsoleRunnerDll" DiskId="1"> - <File Source="..\..\bin\Tools\NUnit\nunit-console-runner.dll" Id="nunit_console_runner.dll" Name="nunit-console-runner.dll" Assembly=".net" AssemblyApplication="nunit_console_runner.dll" AssemblyManifest="nunit_console_runner.dll" KeyPath="yes" /> - </Component> - <Component Guid="6485334C-163C-479E-9ACE-8E738D9BDB96" Id="NUnitCoreDll" DiskId="1"> - <File Source="..\..\bin\Tools\NUnit\nunit.core.dll" Id="nunit.core.dll" Name="nunit.core.dll" /> - </Component> <Component Guid="AB89A052-2D0A-426E-B755-6FA1A9C1C64F" Id="NUnitFrameworkDll" DiskId="1"> <File Source="..\..\bin\Tools\NUnit\nunit.framework.dll" Id="nunit.framework.dll" Name="nunit.framework.dll" /> </Component> - <Component Guid="D67E8EC9-2D98-4889-856F-78FD2BE35947" Id="NUnitCoreInterfacesDll" DiskId="1"> - <File Id="nunit.core.interfaces.dll" KeyPath="yes" Name="nunit.core.interfaces.dll" Assembly=".net" AssemblyApplication="nunit.core.interfaces.dll" AssemblyManifest="nunit.core.interfaces.dll" Source="..\..\bin\Tools\NUnit\nunit.core.interfaces.dll" /> - </Component> <Component Guid="C996D268-4471-4CBF-9015-43357863360A" Id="NUnitConsoleX86Files" DiskId="1"> <File Source="..\..\bin\Tools\NUnit\nunit-console-x86.exe" Name="nunit-console-x86.exe" Id="nunit_console_x86.exe" Assembly=".net" KeyPath="yes" AssemblyApplication="nunit_console_x86.exe" AssemblyManifest="nunit_console_x86.exe" /> <File Source="..\..\bin\Tools\NUnit\nunit-console-x86.exe.config" Name="nunit-console-x86.exe.config" Id="nunit_console_x86.exe.config" /> </Component> + <Directory Id="lib" Name="lib"> + <Component Guid="7A72406E-0E83-4CE7-BB3A-2F3CC2D6F91B" Id="NUnitConsoleRunnerDll" DiskId="1"> + <File Source="..\..\bin\Tools\NUnit\lib\nunit-console-runner.dll" Name="nunit-console-runner.dll" Id="lib.nunit_console_runner.dll" KeyPath="yes" /> + </Component> + <Component Guid="81A713E3-4905-4006-8510-3E1F3AB9AD13" Id="NUnitCoreDll" DiskId="1"> + <File Source="..\..\bin\Tools\NUnit\lib\nunit.core.dll" Name="nunit.core.dll" Id="lib.nunit.core.dll" KeyPath="yes" /> + </Component> + <Component Guid="8E89CF2B-A866-4488-91F9-9079565FD9AE" Id="NUnitCoreInterfacesDll" DiskId="1"> + <File Source="..\..\bin\Tools\NUnit\lib\nunit.core.interfaces.dll" Name="nunit.core.interfaces.dll" Id="lib.nunit.core.interfaces.dll" KeyPath="yes" /> + </Component> + <Component Guid="ECB29CA1-EDDC-4B39-972E-29E54B23DA0B" Id="NUnitUiKitDll" DiskId="1"> + <File Source="..\..\bin\Tools\NUnit\lib\nunit.uikit.dll" Name="nunit.uikit.dll" Id="lib.nunit.uikit.dll" KeyPath="yes" /> + </Component> + <Component Guid="F9388116-85AE-4BF0-8CF6-0E6B5C3DD15F" Id="NUnitUtilDll" DiskId="1"> + <File Source="..\..\bin\Tools\NUnit\lib\nunit.util.dll" Name="nunit.util.dll" Id="lib.nunit.util.dll" KeyPath="yes" /> + </Component> + </Directory> </Directory> <Directory Id="PartCover" Name="PartCover"> <Component Guid="CD9AB556-51BD-4DB2-9AC5-C047022991DD" Id="InteropPartCoverDll" DiskId="1"> diff --git a/src/Setup/Setup.wxs b/src/Setup/Setup.wxs index a6d35944ff..44bb294d78 100644 --- a/src/Setup/Setup.wxs +++ b/src/Setup/Setup.wxs @@ -269,14 +269,13 @@ <ComponentRef Id="SHFBTemplates"/> <ComponentRef Id="SHFBWeb"/> - <ComponentRef Id="NUnitCoreExtensionsDll"/> <ComponentRef Id="NUnitUiKitDll"/> <ComponentRef Id="NUnitUtilDll"/> <ComponentRef Id="NUnitConsoleFiles"/> <ComponentRef Id="NUnitConsoleX86Files"/> <ComponentRef Id="NUnitCoreDll"/> <ComponentRef Id="NUnitFrameworkDll"/> - <ComponentRef Id="NunitConsoleRunnerDll"/> + <ComponentRef Id="NUnitConsoleRunnerDll"/> <ComponentRef Id="NUnitCoreInterfacesDll"/> <ComponentRef Id="ConversionStyleSheetFiles"/> <ComponentRef Id="TextLibOptionsFiles"/> diff --git a/src/Tools/NUnit/buildnunitconsole.bat b/src/Tools/NUnit/buildnunitconsole.bat new file mode 100644 index 0000000000..be9cc0b66a --- /dev/null +++ b/src/Tools/NUnit/buildnunitconsole.bat @@ -0,0 +1,8 @@ +%windir%\microsoft.net\framework\v3.5\msbuild /property:Configuration=Release nunit-console\nunit-console.sln +copy nunit-console.exe nunit-console-x86.exe +"%programfiles%\Microsoft.net\sdk\v2.0\bin\corflags" /32bit+ nunit-console-x86.exe +@IF %ERRORLEVEL% NEQ 0 GOTO err +@exit /B 0 +:err +@PAUSE +@exit /B 1 \ No newline at end of file diff --git a/src/Tools/NUnit/lib/nunit-console-runner.dll b/src/Tools/NUnit/lib/nunit-console-runner.dll new file mode 100644 index 0000000000..d46d2f2400 Binary files /dev/null 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 new file mode 100644 index 0000000000..14c8d7459a Binary files /dev/null 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 new file mode 100644 index 0000000000..5a639ae693 Binary files /dev/null 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 new file mode 100644 index 0000000000..0665537ecc Binary files /dev/null and b/src/Tools/NUnit/lib/nunit.core.interfaces.dll differ diff --git a/src/Tools/NUnit/lib/nunit.fixtures.dll b/src/Tools/NUnit/lib/nunit.fixtures.dll new file mode 100644 index 0000000000..dea2e64407 Binary files /dev/null and b/src/Tools/NUnit/lib/nunit.fixtures.dll differ diff --git a/src/Tools/NUnit/lib/nunit.uiexception.dll b/src/Tools/NUnit/lib/nunit.uiexception.dll new file mode 100644 index 0000000000..3722be6615 Binary files /dev/null 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 new file mode 100644 index 0000000000..d00f219e2b Binary files /dev/null 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 new file mode 100644 index 0000000000..3707bfe0d7 Binary files /dev/null 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 4beb762c93..66a5ebf28b 100644 --- a/src/Tools/NUnit/license.txt +++ b/src/Tools/NUnit/license.txt @@ -1,4 +1,4 @@ -Copyright � 2002-2007 Charlie Poole +Copyright � 2002-2008 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-2007 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-2008 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-runner.dll b/src/Tools/NUnit/nunit-console-runner.dll deleted file mode 100755 index f2dae538b3..0000000000 Binary files a/src/Tools/NUnit/nunit-console-runner.dll and /dev/null differ diff --git a/src/Tools/NUnit/nunit-console-x86.exe b/src/Tools/NUnit/nunit-console-x86.exe index c4f6598689..eb3e9b7c4c 100755 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 fb30fe3edb..539bc32b07 100644 --- a/src/Tools/NUnit/nunit-console-x86.exe.config +++ b/src/Tools/NUnit/nunit-console-x86.exe.config @@ -1,71 +1,42 @@ +<?xml version="1.0"?> <configuration> - - <!-- Do not remove. Sets up configsectionhandler section for log4net --> - <configSections> - <section name="log4net" type="System.Configuration.IgnoreSectionHandler" /> - </configSections> - <!-- Application settings for NUnit-console.exe. Do NOT put settings for use by your tests here. --> <appSettings> - <!-- Specify the location to be used by .NET for the cache --> - <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" /> - + <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" /> </appSettings> - - <system.diagnostics> + + <!-- Set the level for tracing NUnit itself --> + <!-- 0=Off 1=Error 2=Warning 3=Info 4=Debug --> + <system.diagnostics> <switches> - <add name="NTrace" value="4" /> + <add name="NTrace" value="0" /> </switches> - <trace autoflush="true" indentsize="4"> - <listeners> - <add name="NUnitInternalTrace" type="System.Diagnostics.TextWriterTraceListener" - initializeData="C:\NUnitPrimaryTrace.txt"/> - </listeners> - </trace> </system.diagnostics> - - <!-- - The startup section may be used to specify the runtime versions - supported in the order that they will be used if more than one - is present. As supplied, this section is commented out, which - causes nunit-console to use the version of the framework with - which it was built. - - Since .NET 1.0 does not recognize the <supportedRuntime> elements, - a <requiredRuntime> element is used in case it is the only version - of the framework that is installed. - --> - <!-- - <startup> - <supportedRuntime version="v2.0.50727" /> - <supportedRuntime version="v2.0.50215" /> - <supportedRuntime version="v2.0.40607" /> - <supportedRuntime version="v1.1.4322" /> - <supportedRuntime version="v1.0.3705" /> - - <requiredRuntime version="v1.0.3705" /> - </startup> - --> + + <runtime> + <!-- We need this so test exceptions don't crash NUnit --> + <legacyUnhandledExceptionPolicy enabled="1" /> + + <!-- Look for addins in the addins directory for now --> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <probing privatePath="lib;addins"/> + </assemblyBinding> <!-- - The following <runtime> section allows running nunit under + 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.0version 1 + 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. + also need to redirect system assemblies in the test config file, + which controls loading of the tests. --> - - <runtime> - - <legacyUnhandledExceptionPolicy enabled="1" /> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705"> diff --git a/src/Tools/NUnit/nunit-console.exe b/src/Tools/NUnit/nunit-console.exe index 4045f6a41d..398acb0ebf 100755 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 fb30fe3edb..539bc32b07 100644 --- a/src/Tools/NUnit/nunit-console.exe.config +++ b/src/Tools/NUnit/nunit-console.exe.config @@ -1,71 +1,42 @@ +<?xml version="1.0"?> <configuration> - - <!-- Do not remove. Sets up configsectionhandler section for log4net --> - <configSections> - <section name="log4net" type="System.Configuration.IgnoreSectionHandler" /> - </configSections> - <!-- Application settings for NUnit-console.exe. Do NOT put settings for use by your tests here. --> <appSettings> - <!-- Specify the location to be used by .NET for the cache --> - <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" /> - + <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" /> </appSettings> - - <system.diagnostics> + + <!-- Set the level for tracing NUnit itself --> + <!-- 0=Off 1=Error 2=Warning 3=Info 4=Debug --> + <system.diagnostics> <switches> - <add name="NTrace" value="4" /> + <add name="NTrace" value="0" /> </switches> - <trace autoflush="true" indentsize="4"> - <listeners> - <add name="NUnitInternalTrace" type="System.Diagnostics.TextWriterTraceListener" - initializeData="C:\NUnitPrimaryTrace.txt"/> - </listeners> - </trace> </system.diagnostics> - - <!-- - The startup section may be used to specify the runtime versions - supported in the order that they will be used if more than one - is present. As supplied, this section is commented out, which - causes nunit-console to use the version of the framework with - which it was built. - - Since .NET 1.0 does not recognize the <supportedRuntime> elements, - a <requiredRuntime> element is used in case it is the only version - of the framework that is installed. - --> - <!-- - <startup> - <supportedRuntime version="v2.0.50727" /> - <supportedRuntime version="v2.0.50215" /> - <supportedRuntime version="v2.0.40607" /> - <supportedRuntime version="v1.1.4322" /> - <supportedRuntime version="v1.0.3705" /> - - <requiredRuntime version="v1.0.3705" /> - </startup> - --> + + <runtime> + <!-- We need this so test exceptions don't crash NUnit --> + <legacyUnhandledExceptionPolicy enabled="1" /> + + <!-- Look for addins in the addins directory for now --> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <probing privatePath="lib;addins"/> + </assemblyBinding> <!-- - The following <runtime> section allows running nunit under + 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.0version 1 + 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. + also need to redirect system assemblies in the test config file, + which controls loading of the tests. --> - - <runtime> - - <legacyUnhandledExceptionPolicy enabled="1" /> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705"> diff --git a/src/Tools/NUnit/nunit-console/AssemblyInfo.cs b/src/Tools/NUnit/nunit-console/AssemblyInfo.cs index 4801183106..e3c6025b85 100644 --- a/src/Tools/NUnit/nunit-console/AssemblyInfo.cs +++ b/src/Tools/NUnit/nunit-console/AssemblyInfo.cs @@ -16,13 +16,13 @@ using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NUnit.org")] [assembly: AssemblyProduct("NUnit")] -[assembly: AssemblyCopyright("Copyright (C) 2002-2007 Charlie Poole.\r\n" + +[assembly: AssemblyCopyright("Copyright (C) 2002-2008 Charlie Poole.\r\n" + "Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\n" + - "Copyright (C) 2000-2003 Philip Craig.\r\n" + + "Copyright (C) 2000-2002 Philip Craig.\r\n" + "Copyright (C) 2006 Daniel Grunwald.\r\n" + "Copyright (C) 2006-2008 Matt Ward.\r\n" + - "All Rights Reserved.")] -[assembly: AssemblyTrademark("")] + "All Rights Reserved.")] +[assembly: AssemblyTrademark("NUnit is a trademark of NUnit.org")] [assembly: AssemblyCulture("")] // @@ -36,4 +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.4.8")] +[assembly: AssemblyVersion("2.5.0")] +[assembly: AssemblyInformationalVersion("2.5.0")] diff --git a/src/Tools/NUnit/nunit-console/EventCollector.cs b/src/Tools/NUnit/nunit-console/EventCollector.cs index 0a9a45282e..36c3e81714 100644 --- a/src/Tools/NUnit/nunit-console/EventCollector.cs +++ b/src/Tools/NUnit/nunit-console/EventCollector.cs @@ -1,4 +1,9 @@ -using System; +// **************************************************************** +// Copyright 2007, Charlie Poole +// This is free software licensed under the NUnit license. You may +// obtain a copy of the license at http://nunit.org +// **************************************************************** +using System; using System.IO; using System.Diagnostics; using System.Text.RegularExpressions; @@ -75,7 +80,7 @@ namespace NUnit.ConsoleRunner { } - public void TestFinished(TestCaseResult testResult) + public void TestFinished(TestResult testResult) { if(testResult.Executed) { @@ -145,7 +150,7 @@ namespace NUnit.ConsoleRunner } } - public void SuiteFinished(TestSuiteResult suiteResult) + public void SuiteFinished(TestResult suiteResult) { if ( --level == 0) { @@ -219,9 +224,9 @@ namespace NUnit.ConsoleRunner /// <summary> /// Writes a single test result to the output result file. /// </summary> - void WriteTestResult(TestCaseResult testResult) + void WriteTestResult(TestResult testResult) { - testResultWriter.WriteLine("Name: " + testResult.Name); + testResultWriter.WriteLine("Name: " + testResult.FullName); if (testResult.IsFailure) { diff --git a/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs b/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs index 62541f9ec5..11314b3238 100644 --- a/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs +++ b/src/Tools/NUnit/nunit-console/ExtendedConsoleUi.cs @@ -1,18 +1,12 @@ // **************************************************************** // This is free software licensed under the NUnit license. You // may obtain a copy of the license as well as information regarding -// copyright ownership at http://nunit.org/?p=license&r=2.4. +// 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. -// **************************************************************** -// This is free software licensed under the NUnit license. You -// may obtain a copy of the license as well as information regarding -// copyright ownership at http://nunit.org/?p=license&r=2.4. -// **************************************************************** - namespace NUnit.ConsoleRunner { using System; @@ -34,7 +28,6 @@ namespace NUnit.ConsoleRunner public static readonly int INVALID_ARG = -1; public static readonly int FILE_NOT_FOUND = -2; public static readonly int FIXTURE_NOT_FOUND = -3; - public static readonly int TRANSFORM_ERROR = -4; public static readonly int UNEXPECTED_ERROR = -100; public ExtendedConsoleUi() @@ -43,9 +36,6 @@ namespace NUnit.ConsoleRunner public int Execute( ExtendedConsoleOptions options ) { - XmlTextReader transformReader = GetTransformReader(options); - if(transformReader == null) return FILE_NOT_FOUND; - TextWriter outWriter = Console.Out; bool redirectOutput = options.output != null && options.output != string.Empty; if ( redirectOutput ) @@ -71,9 +61,25 @@ namespace NUnit.ConsoleRunner ((StreamWriter)testResultWriter).AutoFlush = true; } - TestRunner testRunner = MakeRunnerFromCommandLine( options ); + 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"); - try + Console.WriteLine("Execution Runtime: {0}", + package.Settings.Contains("RuntimeFramework") + ? package.Settings["RuntimeFramework"] + : "Default"); + + TestRunner testRunner = TestRunnerFactory.MakeTestRunner(package); + testRunner.Load(package); + + try { if (testRunner.Test == null) { @@ -112,7 +118,7 @@ namespace NUnit.ConsoleRunner else testFilter = new AndFilter( testFilter, excludeFilter ); } - + TestResult result = null; string savedDirectory = Environment.CurrentDirectory; TextWriter savedOut = Console.Out; @@ -141,52 +147,45 @@ namespace NUnit.ConsoleRunner Console.WriteLine(); - string xmlOutput = CreateXmlOutput( result ); - - if (options.xmlConsole) - { - Console.WriteLine(xmlOutput); - } - else - { - try - { - //CreateSummaryDocument(xmlOutput, transformReader ); - XmlResultTransform xform = new XmlResultTransform( transformReader ); - xform.Transform( new StringReader( xmlOutput ), Console.Out ); - } - catch( Exception ex ) - { - Console.WriteLine( "Error: {0}", ex.Message ); - return TRANSFORM_ERROR; - } - } + int returnCode = UNEXPECTED_ERROR; - // Write xml output here - string xmlResultFile = options.xml == null || options.xml == string.Empty - ? "TestResult.xml" : options.xml; - - if( options.xml != null ) - { - using ( StreamWriter writer = new StreamWriter( xmlResultFile ) ) - { - writer.Write(xmlOutput); - } - } + if (result != null) + { + string xmlOutput = CreateXmlOutput(result); + ResultSummarizer summary = new ResultSummarizer(result); + + if (options.xmlConsole) + { + Console.WriteLine(xmlOutput); + } + else + { + WriteSummaryReport(summary); + if (summary.ErrorsAndFailures > 0) + WriteErrorsAndFailuresReport(result); + if (summary.TestsNotRun > 0) + WriteNotRunReport(result); + } - //if ( testRunner != null ) - // testRunner.Unload(); + // Write xml output here + string xmlResultFile = options.xml == null || options.xml == string.Empty + ? "TestResult.xml" : options.xml; + + using (StreamWriter writer = new StreamWriter(xmlResultFile)) + { + writer.Write(xmlOutput); + } + + returnCode = summary.ErrorsAndFailures; + } if ( collector.HasExceptions ) { collector.WriteExceptions(); - return UNEXPECTED_ERROR; + returnCode = UNEXPECTED_ERROR; } - if ( !result.IsFailure ) return OK; - - ResultSummarizer summ = new ResultSummarizer( result ); - return summ.FailureCount; + return returnCode; } finally { @@ -195,31 +194,150 @@ namespace NUnit.ConsoleRunner } #region Helper Methods - private static XmlTextReader GetTransformReader(ConsoleOptions parser) - { - return (XmlTextReader)typeof(ConsoleUi).InvokeMember("GetTransformReader", - BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, - null, null, new object[] { parser }); - } + private static TestPackage MakeTestPackage( ConsoleOptions options ) + { + TestPackage package; + DomainUsage domainUsage = DomainUsage.Default; + ProcessModel processModel = ProcessModel.Default; + RuntimeFramework framework = RuntimeFramework.CurrentFramework; - private static TestRunner MakeRunnerFromCommandLine( ConsoleOptions options ) - { - return (TestRunner)typeof(ConsoleUi).InvokeMember("MakeRunnerFromCommandLine", - BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, - null, null, new object[] { options }); + if (options.IsTestProject) + { + NUnitProject project = + Services.ProjectService.LoadProject((string)options.Parameters[0]); + + string configName = options.config; + if (configName != null) + project.SetActiveConfig(configName); + package = project.ActiveConfig.MakeTestPackage(); + processModel = project.ProcessModel; + domainUsage = project.DomainUsage; + framework = project.ActiveConfig.RuntimeFramework; + } + else if (options.Parameters.Count == 1) + { + package = new TestPackage((string)options.Parameters[0]); + domainUsage = DomainUsage.Single; + } + else + { + package = new TestPackage(null, options.Parameters); + domainUsage = DomainUsage.Multiple; + } + + if (options.process != ProcessModel.Default) + processModel = options.process; + + 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; + package.Settings["DomainUsage"] = domainUsage; + if (framework != null) + package.Settings["RuntimeFramework"] = framework; + + + + if (domainUsage == DomainUsage.None) + { + // Make sure that addins are available + CoreExtensions.Host.AddinRegistry = Services.AddinRegistry; + } + + package.Settings["ShadowCopyFiles"] = !options.noshadow; + package.Settings["UseThreadedRunner"] = !options.nothread; + package.Settings["DefaultTimeout"] = options.timeout; + + return package; } private static string CreateXmlOutput( TestResult result ) { StringBuilder builder = new StringBuilder(); - XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result); - result.Accept(resultVisitor); - resultVisitor.Write(); + new XmlResultWriter(new StringWriter( builder )).SaveTestResult(result); return builder.ToString(); } - #endregion + + private static void WriteSummaryReport( ResultSummarizer summary ) + { + Console.WriteLine( + "Tests run: {0}, Errors: {1}, Failures: {2}, Inconclusive: {3} Time: {4} seconds", + summary.TestsRun, summary.Errors, summary.Failures, summary.Inconclusive, summary.Time); + Console.WriteLine( + " Not run: {0}, Invalid: {1}, Ignored: {2}, Skipped: {3}", + summary.TestsNotRun, summary.NotRunnable, summary.Ignored, summary.Skipped); + Console.WriteLine(); + } + + private void WriteErrorsAndFailuresReport(TestResult result) + { + reportIndex = 0; + Console.WriteLine("Errors and Failures:"); + WriteErrorsAndFailures(result); + Console.WriteLine(); + } + + private void WriteErrorsAndFailures(TestResult result) + { + if (result.Executed) + { + if (result.HasResults) + { + if ( (result.IsFailure || result.IsError) && result.FailureSite == FailureSite.SetUp) + WriteSingleResult(result); + + foreach (TestResult childResult in result.Results) + WriteErrorsAndFailures(childResult); + } + else if (result.IsFailure || result.IsError) + { + WriteSingleResult(result); + } + } + } + + private void WriteNotRunReport(TestResult result) + { + reportIndex = 0; + Console.WriteLine("Tests Not Run:"); + WriteNotRunResults(result); + Console.WriteLine(); + } + + private int reportIndex = 0; + private void WriteNotRunResults(TestResult result) + { + if (result.HasResults) + foreach (TestResult childResult in result.Results) + WriteNotRunResults(childResult); + else if (!result.Executed) + WriteSingleResult( result ); + } + + private void WriteSingleResult( TestResult result ) + { + string status = result.IsFailure || result.IsError + ? string.Format("{0} {1}", result.FailureSite, result.ResultState) + : result.ResultState.ToString(); + + Console.WriteLine("{0}) {1} : {2}", ++reportIndex, status, result.FullName); + + if ( result.Message != null && result.Message != string.Empty ) + Console.WriteLine(" {0}", result.Message); + + if (result.StackTrace != null && result.StackTrace != string.Empty) + Console.WriteLine( result.IsFailure + ? StackTraceFilter.Filter(result.StackTrace) + : result.StackTrace + Environment.NewLine ); + } + #endregion } } diff --git a/src/Tools/NUnit/nunit-console/ExtendedRunner.cs b/src/Tools/NUnit/nunit-console/ExtendedRunner.cs index b2700bdab9..d3016d254e 100644 --- a/src/Tools/NUnit/nunit-console/ExtendedRunner.cs +++ b/src/Tools/NUnit/nunit-console/ExtendedRunner.cs @@ -1,3 +1,9 @@ +// **************************************************************** +// Copyright 2008, Charlie Poole +// This is free software licensed under the NUnit license. You may +// obtain a copy of the license 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. @@ -14,15 +20,17 @@ namespace NUnit.ConsoleRunner /// Modified version of NUnit's Runner class to support the ExtendedConsoleOptions /// and the ExtendedConsoleUi class. /// </summary> - public class Runner + public class ExtendedRunner { + static Logger log = InternalTrace.GetLogger(typeof(ExtendedRunner)); + [STAThread] public static int Main(string[] args) { - NTrace.Info( "NUnit-console.exe starting" ); + log.Info( "NUnit-console.exe starting" ); ExtendedConsoleOptions options = new ExtendedConsoleOptions(args); - + if(!options.nologo) WriteCopyright(); @@ -51,12 +59,14 @@ namespace NUnit.ConsoleRunner ServiceManager.Services.AddService( new SettingsService() ); ServiceManager.Services.AddService( new DomainManager() ); //ServiceManager.Services.AddService( new RecentFilesService() ); + ServiceManager.Services.AddService( new ProjectService() ); //ServiceManager.Services.AddService( new TestLoader() ); ServiceManager.Services.AddService( new AddinRegistry() ); ServiceManager.Services.AddService( new AddinManager() ); - // TODO: Resolve conflict with gui testagency when running + // Hack: Resolves conflict with gui testagency when running // console tests under the gui. - //ServiceManager.Services.AddService( new TestAgency() ); + if ( !AppDomain.CurrentDomain.FriendlyName.StartsWith("test-domain-") ) + ServiceManager.Services.AddService( new TestAgency() ); // Initialize Services ServiceManager.Services.InitializeServices(); @@ -84,7 +94,7 @@ namespace NUnit.ConsoleRunner Console.ReadLine(); } - NTrace.Info( "NUnit-console.exe terminating" ); + log.Info( "NUnit-console.exe terminating" ); } } @@ -92,10 +102,10 @@ namespace NUnit.ConsoleRunner private static void WriteCopyright() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); - System.Version version = executingAssembly.GetName().Version; + string versionText = executingAssembly.GetName().Version.ToString(); string productName = "NUnit"; - string copyrightText = "Copyright (C) 2002-2007 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig.\r\nAll Rights Reserved."; + string copyrightText = "Copyright (C) 2002-2008 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig.\r\nAll Rights Reserved."; object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false); if ( objectAttrs.Length > 0 ) @@ -105,7 +115,11 @@ namespace NUnit.ConsoleRunner if ( objectAttrs.Length > 0 ) copyrightText = ((AssemblyCopyrightAttribute)objectAttrs[0]).Copyright; - Console.WriteLine(String.Format("{0} version {1}", productName, version.ToString(3))); + objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false); + if ( objectAttrs.Length > 0 ) + versionText += string.Format(" ({0})", ((AssemblyConfigurationAttribute)objectAttrs[0]).Configuration); + + Console.WriteLine(String.Format("{0} version {1}", productName, versionText)); Console.WriteLine(copyrightText); Console.WriteLine(); @@ -113,7 +127,7 @@ namespace NUnit.ConsoleRunner RuntimeFramework framework = RuntimeFramework.CurrentFramework; Console.WriteLine( string.Format(" OS Version: {0}", Environment.OSVersion ) ); Console.WriteLine( string.Format(" CLR Version: {0} ( {1} )", - Environment.Version, framework.GetDisplayName() ) ); + Environment.Version, framework.DisplayName ) ); Console.WriteLine(); } diff --git a/src/Tools/NUnit/nunit-console/nunit-console.csproj b/src/Tools/NUnit/nunit-console/nunit-console.csproj index e34dd64ae8..a1d576a9e4 100644 --- a/src/Tools/NUnit/nunit-console/nunit-console.csproj +++ b/src/Tools/NUnit/nunit-console/nunit-console.csproj @@ -11,12 +11,12 @@ <RegisterForComInterop>False</RegisterForComInterop> <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <BaseAddress>285212672</BaseAddress> - <PlatformTarget>AnyCPU</PlatformTarget> <FileAlignment>512</FileAlignment> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <ApplicationIcon>App.ico</ApplicationIcon> + <SourceAnalysisOverrideSettingsFile>C:\Users\matt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <OutputPath>..\</OutputPath> @@ -34,26 +34,40 @@ <DebugType>None</DebugType> <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> </PropertyGroup> + <PropertyGroup Condition=" '$(Platform)' == 'x86'"> + <RegisterForComInterop>False</RegisterForComInterop> + <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> + <BaseAddress>4194304</BaseAddress> + <PlatformTarget>x86</PlatformTarget> + <FileAlignment>4096</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> + <RegisterForComInterop>False</RegisterForComInterop> + <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> + <BaseAddress>4194304</BaseAddress> + <PlatformTarget>AnyCPU</PlatformTarget> + <FileAlignment>4096</FileAlignment> + </PropertyGroup> <ItemGroup> <Reference Include="nunit.core.interfaces"> - <HintPath>..\nunit.core.interfaces.dll</HintPath> + <HintPath>..\lib\nunit.core.interfaces.dll</HintPath> <SpecificVersion>False</SpecificVersion> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="nunit.util"> - <HintPath>..\nunit.util.dll</HintPath> + <HintPath>..\lib\nunit.util.dll</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> <Reference Include="nunit.core"> - <HintPath>..\nunit.core.dll</HintPath> + <HintPath>..\lib\nunit.core.dll</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> <Reference Include="nunit-console-runner"> - <HintPath>..\nunit-console-runner.dll</HintPath> + <HintPath>..\lib\nunit-console-runner.dll</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> diff --git a/src/Tools/NUnit/nunit.core.dll b/src/Tools/NUnit/nunit.core.dll deleted file mode 100755 index a31edfdd9e..0000000000 Binary files a/src/Tools/NUnit/nunit.core.dll and /dev/null differ diff --git a/src/Tools/NUnit/nunit.core.extensions.dll b/src/Tools/NUnit/nunit.core.extensions.dll deleted file mode 100755 index ca1ce33531..0000000000 Binary files a/src/Tools/NUnit/nunit.core.extensions.dll and /dev/null differ diff --git a/src/Tools/NUnit/nunit.core.interfaces.dll b/src/Tools/NUnit/nunit.core.interfaces.dll deleted file mode 100755 index 2c48764c8a..0000000000 Binary files a/src/Tools/NUnit/nunit.core.interfaces.dll and /dev/null differ diff --git a/src/Tools/NUnit/nunit.framework.dll b/src/Tools/NUnit/nunit.framework.dll index 2a0a0aa326..50e26cc461 100755 Binary files a/src/Tools/NUnit/nunit.framework.dll and b/src/Tools/NUnit/nunit.framework.dll differ diff --git a/src/Tools/NUnit/nunit.uikit.dll b/src/Tools/NUnit/nunit.uikit.dll deleted file mode 100755 index 448142988e..0000000000 Binary files a/src/Tools/NUnit/nunit.uikit.dll and /dev/null differ diff --git a/src/Tools/NUnit/nunit.util.dll b/src/Tools/NUnit/nunit.util.dll deleted file mode 100755 index 8f51b27842..0000000000 Binary files a/src/Tools/NUnit/nunit.util.dll and /dev/null differ diff --git a/src/Tools/NUnit/rowtest-license.txt b/src/Tools/NUnit/rowtest-license.txt deleted file mode 100644 index fb345fb72f..0000000000 --- a/src/Tools/NUnit/rowtest-license.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2007 Andreas Schlapsi - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build index 76bc932cea..4dcc2ffcee 100644 --- a/src/Tools/Tools.build +++ b/src/Tools/Tools.build @@ -14,6 +14,7 @@ <WixLibFiles Include="wix\lib\*"/> <NUnitFiles Include="NUnit\*.dll;NUnit\*.exe"/> <NUnitConfigFiles Include="NUnit\nunit-console.exe.config;NUnit\nunit-console-x86.exe.config"/> + <NUnitLibFiles Include="NUnit\lib\*.dll"/> <HelpToolFiles Include="Help\*"/> <PartCoverFiles Include="PartCover\*"/> <PartCoverXsltFiles Include="PartCover\xslt\*"/> @@ -35,6 +36,7 @@ <Copy SourceFiles="@(WixLibFiles)" DestinationFolder="..\..\bin\Tools\Wix\lib" SkipUnchangedFiles="true"/> <Copy SourceFiles="@(NUnitFiles)" DestinationFolder="..\..\bin\Tools\NUnit" SkipUnchangedFiles="true"/> <Copy SourceFiles="@(NUnitConfigFiles)" DestinationFolder="..\..\bin\Tools\NUnit" SkipUnchangedFiles="true"/> + <Copy SourceFiles="@(NUnitLibFiles)" DestinationFolder="..\..\bin\Tools\NUnit\lib" SkipUnchangedFiles="true"/> <Copy SourceFiles="@(ToolFiles)" DestinationFolder="..\..\bin\Tools" SkipUnchangedFiles="true"/> <Copy SourceFiles="@(PartCoverFiles)" DestinationFolder="..\..\bin\Tools\PartCover" SkipUnchangedFiles="true"/> <Copy SourceFiles="@(PartCoverXsltFiles)" DestinationFolder="..\..\bin\Tools\PartCover\Xslt" SkipUnchangedFiles="true"/>