Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,25 @@
// ****************************************************************
// 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.
// ****************************************************************
using System;
namespace NUnit.ConsoleRunner
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static int Main(string[] args)
{
return Runner.Main( args );
}
}
}

View File

@@ -0,0 +1,15 @@
thisdir = nunit24/ConsoleRunner/nunit-console-exe
SUBDIRS =
include ../../../build/rules.make
PROGRAM = nunit-console.exe
LOCAL_MCS_FLAGS = \
/r:nunit.framework.dll /r:nunit.util.dll /r:nunit.core.dll \
/r:nunit-console-runner.dll
EXTRA_DISTFILES = App.ico \
nunit-console.exe.csproj \
nunit-console.exe_VS2005.csproj \
nunit-console.exe.config.net_2_0 \
nunit-console.exe.config.net_3_5
include ../../../build/executable.make

View File

@@ -0,0 +1,11 @@
// ****************************************************************
// 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.
// ****************************************************************
using System;
using System.Reflection;
[assembly: AssemblyTitle("NUnit-Console")]
[assembly: AssemblyDescription("")]

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="Windows-1252"?>
<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" />
</appSettings>
<system.diagnostics>
<switches>
<add name="NTrace" value="4" />
</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>
-->
<!--
The following <runtime> 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
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.
-->
<runtime>
<legacyUnhandledExceptionPolicy enabled="1" />
<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>
</configuration>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="Windows-1252"?>
<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" />
</appSettings>
<system.diagnostics>
<switches>
<add name="NTrace" value="4" />
</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" />
</startup>
<!--
The following <runtime> 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
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.
-->
<runtime>
<legacyUnhandledExceptionPolicy enabled="1" />
<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>
</configuration>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="Windows-1252"?>
<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" />
</appSettings>
<system.diagnostics>
<switches>
<add name="NTrace" value="4" />
</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" />
</startup>
<!--
The following <runtime> 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
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.
-->
<runtime>
<legacyUnhandledExceptionPolicy enabled="1" />
<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>
</configuration>

View File

@@ -0,0 +1,124 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "nunit-console"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "NUnit.ConsoleRunner"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "nunit-console"
Project = "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "nunit.core.extensions.dll"
Project = "{98B10E98-003C-45A0-9587-119142E39986}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "app.config"
BuildAction = "None"
/>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "assemblyinfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Class1.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "CommonAssemblyInfo.cs"
Link = "..\..\CommonAssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,3 @@
../../CommonAssemblyInfo.cs
Class1.cs
assemblyinfo.cs

View File

@@ -0,0 +1,79 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>App.ico</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>nunit-console</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<RootNamespace>NUnit.ConsoleRunner</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
<OutputPath>bin\Release2005\</OutputPath>
<DefineConstants>TRACE;VS2005</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug2005\</OutputPath>
<DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
<BaseAddress>285212672</BaseAddress>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<Content Include="App.ico" />
<Compile Include="..\..\CommonAssemblyInfo.cs">
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Class1.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\NUnitExtensions\core\nunit.core.extensions.dll_VS2005.csproj">
<Project>{98B10E98-003C-45A0-9587-119142E39986}</Project>
<Name>nunit.core.extensions.dll_VS2005</Name>
</ProjectReference>
<ProjectReference Include="..\nunit-console\nunit-console_VS2005.csproj">
<Project>{9367EC89-6A38-42BA-9607-0DC288E4BC3A}</Project>
<Name>nunit-console_VS2005</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,11 @@
// ****************************************************************
// 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.
// ****************************************************************
using System.Reflection;
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("../../nunit.snk")]
[assembly: AssemblyKeyName("")]

View File

@@ -0,0 +1,127 @@
// ****************************************************************
// 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;
using Codeblast;
using NUnit.Util;
public class ConsoleOptions : CommandLineOptions
{
public enum DomainUsage
{
Default,
None,
Single,
Multiple
}
[Option(Short="load", Description = "Test fixture to be loaded")]
public string fixture;
[Option(Description = "Name of the test to run")]
public string run;
[Option(Description = "Project configuration to load")]
public string config;
[Option(Description = "Name of XML output file")]
public string xml;
[Option(Description = "Name of transform file")]
public string transform;
[Option(Description = "Display XML to the console")]
public bool xmlConsole;
[Option(Short="out", Description = "File to receive test output")]
public string output;
[Option(Description = "File to receive test error output")]
public string err;
[Option(Description = "Label each test in stdOut")]
public bool labels = false;
[Option(Description = "List of categories to include")]
public string include;
[Option(Description = "List of categories to exclude")]
public string exclude;
// [Option(Description = "Run in a separate process")]
// public bool process;
[Option(Description = "AppDomain Usage for Tests")]
public DomainUsage domain;
[Option(Description = "Disable shadow copy when running in separate domain")]
public bool noshadow;
[Option (Description = "Disable use of a separate thread for tests")]
public bool nothread;
[Option(Description = "Wait for input before closing console window")]
public bool wait = false;
[Option(Description = "Do not display the logo")]
public bool nologo = false;
[Option(Description = "Do not display progress" )]
public bool nodots = false;
[Option(Short="?", Description = "Display help")]
public bool help = false;
public ConsoleOptions( params string[] args ) : base( args ) {}
public ConsoleOptions( bool allowForwardSlash, params string[] args ) : base( allowForwardSlash, args ) {}
public bool Validate()
{
if(isInvalid) return false;
if(NoArgs) return true;
if(ParameterCount >= 1) return true;
return false;
}
protected override bool IsValidParameter(string parm)
{
return NUnitProject.CanLoadAsProject( parm ) || PathUtils.IsAssemblyFileType( parm );
}
public bool IsTestProject
{
get
{
return ParameterCount == 1 && NUnitProject.CanLoadAsProject((string)Parameters[0]);
}
}
public override void Help()
{
Console.WriteLine();
Console.WriteLine( "NUNIT-CONSOLE [inputfiles] [options]" );
Console.WriteLine();
Console.WriteLine( "Runs a set of NUnit tests from the console." );
Console.WriteLine();
Console.WriteLine( "You may specify one or more assemblies or a single" );
Console.WriteLine( "project file of type .nunit." );
Console.WriteLine();
Console.WriteLine( "Options:" );
base.Help();
Console.WriteLine();
Console.WriteLine( "Options that take values may use an equal sign, a colon" );
Console.WriteLine( "or a space to separate the option from its value." );
Console.WriteLine();
}
}
}

View File

@@ -0,0 +1,275 @@
// ****************************************************************
// 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;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Resources;
using System.Text;
using NUnit.Core;
using NUnit.Core.Filters;
using NUnit.Util;
/// <summary>
/// Summary description for ConsoleUi.
/// </summary>
public class ConsoleUi
{
public static readonly int OK = 0;
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 ConsoleUi()
{
}
public int Execute( ConsoleOptions 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 )
{
StreamWriter outStreamWriter = new StreamWriter( options.output );
outStreamWriter.AutoFlush = true;
outWriter = outStreamWriter;
}
TextWriter errorWriter = Console.Error;
bool redirectError = options.err != null && options.err != string.Empty;
if ( redirectError )
{
StreamWriter errorStreamWriter = new StreamWriter( options.err );
errorStreamWriter.AutoFlush = true;
errorWriter = errorStreamWriter;
}
TestRunner testRunner = MakeRunnerFromCommandLine( options );
try
{
if (testRunner.Test == null)
{
testRunner.Unload();
Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture);
return FIXTURE_NOT_FOUND;
}
EventCollector collector = new EventCollector( options, outWriter, errorWriter );
TestFilter testFilter = TestFilter.Empty;
if ( options.run != null && options.run != string.Empty )
{
Console.WriteLine( "Selected test: " + options.run );
testFilter = new SimpleNameFilter( options.run );
}
if ( options.include != null && options.include != string.Empty )
{
Console.WriteLine( "Included categories: " + options.include );
TestFilter includeFilter = new CategoryExpression( options.include ).Filter;
if ( testFilter.IsEmpty )
testFilter = includeFilter;
else
testFilter = new AndFilter( testFilter, includeFilter );
}
if ( options.exclude != null && options.exclude != string.Empty )
{
Console.WriteLine( "Excluded categories: " + options.exclude );
TestFilter excludeFilter = new NotFilter( new CategoryExpression( options.exclude ).Filter );
if ( testFilter.IsEmpty )
testFilter = excludeFilter;
else if ( testFilter is AndFilter )
((AndFilter)testFilter).Add( excludeFilter );
else
testFilter = new AndFilter( testFilter, excludeFilter );
}
TestResult result = null;
string savedDirectory = Environment.CurrentDirectory;
TextWriter savedOut = Console.Out;
TextWriter savedError = Console.Error;
try
{
result = testRunner.Run( collector, testFilter );
}
finally
{
outWriter.Flush();
errorWriter.Flush();
if ( redirectOutput )
outWriter.Close();
if ( redirectError )
errorWriter.Close();
Environment.CurrentDirectory = savedDirectory;
Console.SetOut( savedOut );
Console.SetError( savedError );
}
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;
}
}
// 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);
}
//if ( testRunner != null )
// testRunner.Unload();
if ( collector.HasExceptions )
{
collector.WriteExceptions();
return UNEXPECTED_ERROR;
}
if ( !result.IsFailure ) return OK;
ResultSummarizer summ = new ResultSummarizer( result );
return summ.FailureCount;
}
finally
{
testRunner.Unload();
}
}
#region Helper Methods
private static XmlTextReader GetTransformReader(ConsoleOptions parser)
{
XmlTextReader reader = null;
if(parser.transform == null || parser.transform == string.Empty)
{
Assembly assembly = Assembly.GetAssembly(typeof(XmlResultVisitor));
ResourceManager resourceManager = new ResourceManager("NUnit.Util.Transform",assembly);
string xmlData = (string)resourceManager.GetObject("Summary.xslt");
reader = new XmlTextReader(new StringReader(xmlData));
}
else
{
FileInfo xsltInfo = new FileInfo(parser.transform);
if(!xsltInfo.Exists)
{
Console.Error.WriteLine("Transform file: {0} does not exist", xsltInfo.FullName);
reader = null;
}
else
{
reader = new XmlTextReader(xsltInfo.FullName);
}
}
return reader;
}
private static TestRunner MakeRunnerFromCommandLine( ConsoleOptions options )
{
TestPackage package;
ConsoleOptions.DomainUsage domainUsage = ConsoleOptions.DomainUsage.Default;
if (options.IsTestProject)
{
NUnitProject project = NUnitProject.LoadProject((string)options.Parameters[0]);
string configName = options.config;
if (configName != null)
project.SetActiveConfig(configName);
package = project.ActiveConfig.MakeTestPackage();
package.TestName = options.fixture;
domainUsage = ConsoleOptions.DomainUsage.Single;
}
else if (options.Parameters.Count == 1)
{
package = new TestPackage((string)options.Parameters[0]);
domainUsage = ConsoleOptions.DomainUsage.Single;
}
else
{
package = new TestPackage("UNNAMED", options.Parameters);
domainUsage = ConsoleOptions.DomainUsage.Multiple;
}
if (options.domain != ConsoleOptions.DomainUsage.Default)
domainUsage = options.domain;
TestRunner testRunner = null;
switch( domainUsage )
{
case ConsoleOptions.DomainUsage.None:
testRunner = new NUnit.Core.RemoteTestRunner();
// Make sure that addins are available
CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
break;
case ConsoleOptions.DomainUsage.Single:
testRunner = new TestDomain();
break;
case ConsoleOptions.DomainUsage.Multiple:
testRunner = new MultipleTestDomainRunner();
break;
}
package.TestName = options.fixture;
package.Settings["ShadowCopyFiles"] = !options.noshadow;
package.Settings["UseThreadedRunner"] = !options.nothread;
testRunner.Load( package );
return testRunner;
}
private static string CreateXmlOutput( TestResult result )
{
StringBuilder builder = new StringBuilder();
XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result);
result.Accept(resultVisitor);
resultVisitor.Write();
return builder.ToString();
}
#endregion
}
}

View File

@@ -0,0 +1,209 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Specialized;
using NUnit.Core;
using NUnit.Util;
namespace NUnit.ConsoleRunner
{
/// <summary>
/// Summary description for EventCollector.
/// </summary>
public class EventCollector : MarshalByRefObject, EventListener
{
private int testRunCount;
private int testIgnoreCount;
private int failureCount;
private int level;
private ConsoleOptions options;
private TextWriter outWriter;
private TextWriter errorWriter;
StringCollection messages;
private bool progress = false;
private string currentTestName;
private ArrayList unhandledExceptions = new ArrayList();
public EventCollector( ConsoleOptions options, TextWriter outWriter, TextWriter errorWriter )
{
level = 0;
this.options = options;
this.outWriter = outWriter;
this.errorWriter = errorWriter;
this.currentTestName = string.Empty;
this.progress = !options.xmlConsole && !options.labels && !options.nodots;
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(OnUnhandledException);
}
public bool HasExceptions
{
get { return unhandledExceptions.Count > 0; }
}
public void WriteExceptions()
{
Console.WriteLine();
Console.WriteLine("Unhandled exceptions:");
int index = 1;
foreach( string msg in unhandledExceptions )
Console.WriteLine( "{0}) {1}", index++, msg );
}
public void RunStarted(string name, int testCount)
{
}
public void RunFinished(TestResult result)
{
}
public void RunFinished(Exception exception)
{
}
public void TestFinished(TestCaseResult testResult)
{
if(testResult.Executed)
{
testRunCount++;
if(testResult.IsFailure)
{
failureCount++;
if ( progress )
Console.Write("F");
messages.Add( string.Format( "{0}) {1} :", failureCount, testResult.Test.TestName.FullName ) );
messages.Add( testResult.Message.Trim( Environment.NewLine.ToCharArray() ) );
string stackTrace = StackTraceFilter.Filter( testResult.StackTrace );
if ( stackTrace != null && stackTrace != string.Empty )
{
string[] trace = stackTrace.Split( System.Environment.NewLine.ToCharArray() );
foreach( string s in trace )
{
if ( s != string.Empty )
{
string link = Regex.Replace( s.Trim(), @".* in (.*):line (.*)", "$1($2)");
messages.Add( string.Format( "at\n{0}", link ) );
}
}
}
}
}
else
{
testIgnoreCount++;
if ( progress )
Console.Write("N");
}
currentTestName = string.Empty;
}
public void TestStarted(TestName testName)
{
currentTestName = testName.FullName;
if ( options.labels )
outWriter.WriteLine("***** {0}", currentTestName );
if ( progress )
Console.Write(".");
}
public void SuiteStarted(TestName testName)
{
if ( level++ == 0 )
{
messages = new StringCollection();
testRunCount = 0;
testIgnoreCount = 0;
failureCount = 0;
Trace.WriteLine( "################################ UNIT TESTS ################################" );
Trace.WriteLine( "Running tests in '" + testName.FullName + "'..." );
}
}
public void SuiteFinished(TestSuiteResult suiteResult)
{
if ( --level == 0)
{
Trace.WriteLine( "############################################################################" );
if (messages.Count == 0)
{
Trace.WriteLine( "############## S U C C E S S #################" );
}
else
{
Trace.WriteLine( "############## F A I L U R E S #################" );
foreach ( string s in messages )
{
Trace.WriteLine(s);
}
}
Trace.WriteLine( "############################################################################" );
Trace.WriteLine( "Executed tests : " + testRunCount );
Trace.WriteLine( "Ignored tests : " + testIgnoreCount );
Trace.WriteLine( "Failed tests : " + failureCount );
Trace.WriteLine( "Unhandled exceptions : " + unhandledExceptions.Count);
Trace.WriteLine( "Total time : " + suiteResult.Time + " seconds" );
Trace.WriteLine( "############################################################################");
}
}
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject.GetType() != typeof(System.Threading.ThreadAbortException))
{
this.UnhandledException((Exception)e.ExceptionObject);
}
}
public void UnhandledException( Exception exception )
{
// If we do labels, we already have a newline
unhandledExceptions.Add(currentTestName + " : " + exception.ToString());
//if (!options.labels) outWriter.WriteLine();
string msg = string.Format("##### Unhandled Exception while running {0}", currentTestName);
//outWriter.WriteLine(msg);
//outWriter.WriteLine(exception.ToString());
Trace.WriteLine(msg);
Trace.WriteLine(exception.ToString());
}
public void TestOutput( TestOutput output)
{
switch ( output.Type )
{
case TestOutputType.Out:
outWriter.Write( output.Text );
break;
case TestOutputType.Error:
errorWriter.Write( output.Text );
break;
}
}
public override object InitializeLifetimeService()
{
return null;
}
}
}

View File

@@ -0,0 +1,30 @@
thisdir = nunit24/ConsoleRunner/nunit-console
SUBDIRS =
include ../../../build/rules.make
LIBRARY = nunit-console-runner.dll
LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
LOCAL_MCS_FLAGS= \
-r:nunit.core.dll -r:nunit.core.interfaces.dll -r:nunit.util.dll \
-r:System.dll -r:System.Xml.dll \
/d:MONO /d:StronglyNamedAssembly
NO_TEST = yo
EXTRA_DISTFILES = nunit-console.csproj nunit-console_VS2005.csproj
ifneq (net_2_0, $(PROFILE))
NO_INSTALL = yes
install-local: install-symlink
uninstall-local: uninstall-symlink
endif
include ../../../build/library.make
symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
install-symlink:
$(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../2.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
uninstall-symlink:
rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)

View File

@@ -0,0 +1,117 @@
using System;
using System.IO;
using System.Reflection;
using NUnit.Core;
using NUnit.Util;
namespace NUnit.ConsoleRunner
{
/// <summary>
/// Summary description for Runner.
/// </summary>
public class Runner
{
[STAThread]
public static int Main(string[] args)
{
NTrace.Info( "NUnit-console.exe starting" );
ConsoleOptions options = new ConsoleOptions(args);
if(!options.nologo)
WriteCopyright();
if(options.help)
{
options.Help();
return ConsoleUi.OK;
}
if(options.NoArgs)
{
Console.Error.WriteLine("fatal error: no inputs specified");
options.Help();
return ConsoleUi.OK;
}
if(!options.Validate())
{
foreach( string arg in options.InvalidArguments )
Console.Error.WriteLine("fatal error: invalid argument: {0}", arg );
options.Help();
return ConsoleUi.INVALID_ARG;
}
// Add Standard Services to ServiceManager
ServiceManager.Services.AddService( new SettingsService() );
ServiceManager.Services.AddService( new DomainManager() );
//ServiceManager.Services.AddService( new RecentFilesService() );
//ServiceManager.Services.AddService( new TestLoader() );
ServiceManager.Services.AddService( new AddinRegistry() );
ServiceManager.Services.AddService( new AddinManager() );
// TODO: Resolve conflict with gui testagency when running
// console tests under the gui.
//ServiceManager.Services.AddService( new TestAgency() );
// Initialize Services
ServiceManager.Services.InitializeServices();
try
{
ConsoleUi consoleUi = new ConsoleUi();
return consoleUi.Execute( options );
}
catch( FileNotFoundException ex )
{
Console.WriteLine( ex.Message );
return ConsoleUi.FILE_NOT_FOUND;
}
catch( Exception ex )
{
Console.WriteLine( "Unhandled Exception:\n{0}", ex.ToString() );
return ConsoleUi.UNEXPECTED_ERROR;
}
finally
{
if(options.wait)
{
Console.Out.WriteLine("\nHit <enter> key to continue");
Console.ReadLine();
}
NTrace.Info( "NUnit-console.exe terminating" );
}
}
private static void WriteCopyright()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
System.Version version = executingAssembly.GetName().Version;
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.";
object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if ( objectAttrs.Length > 0 )
productName = ((AssemblyProductAttribute)objectAttrs[0]).Product;
objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if ( objectAttrs.Length > 0 )
copyrightText = ((AssemblyCopyrightAttribute)objectAttrs[0]).Copyright;
Console.WriteLine(String.Format("{0} version {1}", productName, version.ToString(3)));
Console.WriteLine(copyrightText);
Console.WriteLine();
Console.WriteLine( "Runtime Environment - " );
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() ) );
Console.WriteLine();
}
}
}

View File

@@ -0,0 +1,6 @@
../../CommonAssemblyInfo.cs
AssemblyInfo.cs
ConsoleOptions.cs
ConsoleUi.cs
EventCollector.cs
Runner.cs

View File

@@ -0,0 +1,140 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "nunit-console-runner"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "NUnit.ConsoleRunner"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
NoStdLib = "false"
NoWarn = "618"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = "618"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "nunit.util.dll"
Project = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "nunit.core.interfaces.dll"
Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "nunit.core.dll"
Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "CommonAssemblyInfo.cs"
Link = "..\..\CommonAssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "ConsoleOptions.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "ConsoleUi.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "EventCollector.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Runner.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,94 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9367EC89-6A38-42BA-9607-0DC288E4BC3A}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>nunit-console-runner</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>NUnit.ConsoleRunner</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
<OutputPath>bin\Release2005\</OutputPath>
<DefineConstants>TRACE;VS2005</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
<NoWarn>618;1701;1702;1699</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug2005\</OutputPath>
<DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<NoWarn>618;1701;1702;1699</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="App.ico" />
<Compile Include="..\..\CommonAssemblyInfo.cs">
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ConsoleOptions.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ConsoleUi.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="EventCollector.cs" />
<Compile Include="Runner.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ClientUtilities\util\nunit.util.dll_VS2005.csproj">
<Project>{61CE9CE5-943E-44D4-A381-814DC1406767}</Project>
<Name>nunit.util.dll_VS2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
<Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
<Name>nunit.core.dll_VS2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
<Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
<Name>nunit.core.interfaces.dll_VS2005</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>